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
Unified · Split
| @@ -1419,6 +1419,9 @@ static void storvsc_device_destroy(struct scsi_device *sdevice) · 1418 unmodified lines | ||
| 1419 | 1419 | { |
| 1420 | 1420 | struct stor_mem_pools *memp = sdevice->hostdata; |
| 1421 | 1421 | |
| 1422 | + if (!memp) | |
| 1423 | + return; | |
| 1424 | + | |
| 1422 | 1425 | mempool_destroy(memp->request_mempool); |
| 1423 | 1426 | kmem_cache_destroy(memp->request_pool); |
| 1424 | 1427 | kfree(memp); |