3.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ales Novak <alno...@suse.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 <alno...@suse.cz>
Signed-off-by: Thomas Abraham <tabra...@suse.com>
Reviewed-by: Jiri Kosina <jkos...@suse.cz>
Acked-by: K. Y. Srinivasan <k...@microsoft.com>
Signed-off-by: James Bottomley <jbottom...@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 drivers/scsi/storvsc_drv.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1419,6 +1419,9 @@ static void storvsc_device_destroy(struc
 {
        struct stor_mem_pools *memp = sdevice->hostdata;
 
+       if (!memp)
+               return;
+
        mempool_destroy(memp->request_mempool);
        kmem_cache_destroy(memp->request_pool);
        kfree(memp);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to