[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1396272197-13394-44-git-send-email-luis.henriques@canonical.com>
Date: Mon, 31 Mar 2014 14:22:49 +0100
From: Luis Henriques <luis.henriques@...onical.com>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
kernel-team@...ts.ubuntu.com
Cc: Ales Novak <alnovak@...e.cz>, Thomas Abraham <tabraham@...e.com>,
James Bottomley <JBottomley@...allels.com>,
Luis Henriques <luis.henriques@...onical.com>
Subject: [PATCH 3.5 43/71] [SCSI] storvsc: NULL pointer dereference fix
3.5.7.33 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Ales Novak <alnovak@...e.cz>
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@...e.cz>
Signed-off-by: Thomas Abraham <tabraham@...e.com>
Reviewed-by: Jiri Kosina <jkosina@...e.cz>
Acked-by: K. Y. Srinivasan <kys@...rosoft.com>
Signed-off-by: James Bottomley <JBottomley@...allels.com>
Signed-off-by: Luis Henriques <luis.henriques@...onical.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 9f4e560..65f566b 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1141,6 +1141,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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists