From: Doug Maxey <dwm@xxxxxxxxxxx> Fix allocation leaks in qla4xxx_module_init() noticed by Ram Pai. Signed-off-by: Doug Maxey <dwm@xxxxxxxxxxx> --- drivers/scsi/qla4xxx/ql4_os.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 5e10f30..fdba30a 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -1805,7 +1805,8 @@ static int __init qla4xxx_module_init(vo printk(KERN_ERR "%s: Unable to allocate SRB cache..." "Failing load!\n", DRIVER_NAME); - return -ENOMEM; + ret = -ENOMEM; + goto no_srp_cache; } /* Derive version string. */ @@ -1815,16 +1816,23 @@ static int __init qla4xxx_module_init(vo qla4xxx_scsi_transport = iscsi_register_transport(&qla4xxx_iscsi_transport); - if (!qla4xxx_scsi_transport) - return -ENODEV; + if (!qla4xxx_scsi_transport) { + ret = -ENODEV; + goto release_srb_cache; + } printk(KERN_INFO "QLogic iSCSI HBA Driver\n"); ret = pci_module_init(&qla4xxx_pci_driver); - if (ret) { - kmem_cache_destroy(srb_cachep); - iscsi_unregister_transport(&qla4xxx_iscsi_transport); - } + if (ret) + goto unregister_transport; + + return 0; +unregister_transport: + iscsi_unregister_transport(&qla4xxx_iscsi_transport); +release_srb_cache: + kmem_cache_destroy(srb_cachep); +no_srp_cache: return ret; } - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html