Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Make sure to check if the driver has a valid int...



details:   https://anonhg.NetBSD.org/src/rev/65059edc3d74
branches:  trunk
changeset: 789169:65059edc3d74
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Aug 10 18:01:31 2013 +0000

description:
Make sure to check if the driver has a valid intr handler in virtio_detach().

Fixes a panic during shutdown on KVM under ubuntu 13.04 with virtio,
as reported in PR kern/48105 by Richard Hansen.

Should be pulled up to netbsd-6 branches.

diffstat:

 sys/dev/pci/virtio.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r f80fa6c051aa -r 65059edc3d74 sys/dev/pci/virtio.c
--- a/sys/dev/pci/virtio.c      Sat Aug 10 00:48:04 2013 +0000
+++ b/sys/dev/pci/virtio.c      Sat Aug 10 18:01:31 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */
+/*     $NetBSD: virtio.c,v 1.4 2013/08/10 18:01:31 tsutsui Exp $       */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.4 2013/08/10 18:01:31 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -199,8 +199,10 @@
        }
        KASSERT(sc->sc_child == 0 || sc->sc_child == (void*)1);
        KASSERT(sc->sc_vqs == 0);
-       pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
-       sc->sc_ih = 0;
+       if (sc->sc_ih != NULL) {
+               pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
+               sc->sc_ih = NULL;
+       }
        if (sc->sc_iosize)
                bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_iosize);
        sc->sc_iosize = 0;



Home | Main Index | Thread Index | Old Index