From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LSYsR-0002TU-5g for qemu-devel@nongnu.org; Thu, 29 Jan 2009 10:32:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LSYsP-0002T4-G6 for qemu-devel@nongnu.org; Thu, 29 Jan 2009 10:32:22 -0500 Received: from [199.232.76.173] (port=60253 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSYsP-0002T1-Ck for qemu-devel@nongnu.org; Thu, 29 Jan 2009 10:32:21 -0500 Received: from mail05.svc.cra.dublin.eircom.net ([159.134.118.21]:38987) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LSYsP-0002Pe-2m for qemu-devel@nongnu.org; Thu, 29 Jan 2009 10:32:21 -0500 From: Mark McLoughlin Date: Thu, 29 Jan 2009 15:32:16 +0000 Message-Id: <1233243136-8028-1-git-send-email-markmc@redhat.com> Subject: [Qemu-devel] [PATCH] virtio-pci: do not oops on config change if driver not loaded Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rusty Russell Cc: Mark McLoughlin , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org The host really shouldn't be notifying us of config changes before the device status is VIRTIO_CONFIG_S_DRIVER or VIRTIO_CONFIG_S_DRIVER_OK. However, if we do happen to be interrupted while we're not attached to a driver, we really shouldn't oops. Prevent this simply by checking that device->driver is non-NULL before trying to notify the driver of config changes. Problem observed by doing a "set_link virtio.0 down" with QEMU before the net driver had been loaded. Signed-off-by: Mark McLoughlin --- drivers/virtio/virtio_pci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index bef6b45..330aacb 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c @@ -192,7 +192,7 @@ static irqreturn_t vp_interrupt(int irq, void *opaque) drv = container_of(vp_dev->vdev.dev.driver, struct virtio_driver, driver); - if (drv->config_changed) + if (drv && drv->config_changed) drv->config_changed(&vp_dev->vdev); } -- 1.6.0.6