[3.11.y.z extended stable] Patch "[SCSI] storvsc: NULL pointer dereference fix" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Thu Mar 20 13:25:59 UTC 2014


This is a note to let you know that I have just added a patch titled

    [SCSI] storvsc: NULL pointer dereference fix

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From db6f4d6b27702e7a6d480342f0ebb5dd417bf5c1 Mon Sep 17 00:00:00 2001
From: Ales Novak <alnovak at suse.cz>
Date: Thu, 27 Feb 2014 11:03:30 +0100
Subject: [SCSI] storvsc: NULL pointer dereference fix

commit b12bb60d6c350b348a4e1460cd68f97ccae9822e upstream.

If the initialization of storvsc fails, the storvsc_device_destroy()
causes NULL pointer dereference.

storvsc_bus_scan()
  scsi_scan_target()
    __scsi_scan_target()
      scsi_probe_and_add_lun(hostdata=NULL)
        scsi_alloc_sdev(hostdata=NULL)

	  sdev->hostdata = hostdata

	  now the host allocation fails

          __scsi_remove_device(sdev)

	  calls sdev->host->hostt->slave_destroy() ==
	  storvsc_device_destroy(sdev)
	    access of sdev->hostdata->request_mempool

Signed-off-by: Ales Novak <alnovak at suse.cz>
Signed-off-by: Thomas Abraham <tabraham at suse.com>
Reviewed-by: Jiri Kosina <jkosina at suse.cz>
Acked-by: K. Y. Srinivasan <kys at microsoft.com>
Signed-off-by: James Bottomley <JBottomley at Parallels.com>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/scsi/storvsc_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 93d0707..eeb6795 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1419,6 +1419,9 @@ static void storvsc_device_destroy(struct scsi_device *sdevice)
 {
 	struct stor_mem_pools *memp = sdevice->hostdata;

+	if (!memp)
+		return;
+
 	mempool_destroy(memp->request_mempool);
 	kmem_cache_destroy(memp->request_pool);
 	kfree(memp);
--
1.9.1





More information about the kernel-team mailing list