This is a note to let you know that I've just added the patch titled

    virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze

to the 3.13-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     virtio-scsi-fix-hotcpu_notifier-use-after-free-with-virtscsi_freeze.patch
and it can be found in the queue-3.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From f466f75385369a181409e46da272db3de6f5c5cb Mon Sep 17 00:00:00 2001
From: Asias He <[email protected]>
Date: Thu, 16 Jan 2014 10:18:48 +1030
Subject: virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze

From: Asias He <[email protected]>

commit f466f75385369a181409e46da272db3de6f5c5cb upstream.

vqs are freed in virtscsi_freeze but the hotcpu_notifier is not
unregistered. We will have a use-after-free usage when the notifier
callback is called after virtscsi_freeze.

Fixes: 285e71ea6f3583a85e27cb2b9a7d8c35d4c0d558
("virtio-scsi: reset virtqueue affinity when doing cpu hotplug")

Signed-off-by: Asias He <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/scsi/virtio_scsi.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -956,6 +956,10 @@ static void virtscsi_remove(struct virti
 #ifdef CONFIG_PM_SLEEP
 static int virtscsi_freeze(struct virtio_device *vdev)
 {
+       struct Scsi_Host *sh = virtio_scsi_host(vdev);
+       struct virtio_scsi *vscsi = shost_priv(sh);
+
+       unregister_hotcpu_notifier(&vscsi->nb);
        virtscsi_remove_vqs(vdev);
        return 0;
 }
@@ -964,8 +968,17 @@ static int virtscsi_restore(struct virti
 {
        struct Scsi_Host *sh = virtio_scsi_host(vdev);
        struct virtio_scsi *vscsi = shost_priv(sh);
+       int err;
+
+       err = virtscsi_init(vdev, vscsi);
+       if (err)
+               return err;
+
+       err = register_hotcpu_notifier(&vscsi->nb);
+       if (err)
+               vdev->config->del_vqs(vdev);
 
-       return virtscsi_init(vdev, vscsi);
+       return err;
 }
 #endif
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.13/virtio-scsi-fix-hotcpu_notifier-use-after-free-with-virtscsi_freeze.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to