From c24a1710d18d706ee2bbd87390868242f1a6d8d5 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Wed, 30 Nov 2011 17:14:22 -0800 Subject: [PATCH] [SCSI] mpt2sas: Fix leak on mpt2sas_base_attach() error path Commit 911ae9434f83 ("[SCSI] mpt2sas: Added NUNA IO support in driver which uses multi-reply queue support of the HBA") added new allocations to the beginning of mpt2sas_base_attach(), which means directly returning an error on failure of mpt2sas_base_map_resources() will leak those allocations. Fix this by doing "goto out_free_resources" in this place too, as the rest of the function does. Signed-off-by: Roland Dreier Acked-by: "Nandigama, Nagalakshmi" Signed-off-by: James Bottomley --- drivers/scsi/mpt2sas/mpt2sas_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 961b11ea8c04..65c377dc0279 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -4256,7 +4256,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) r = mpt2sas_base_map_resources(ioc); if (r) - return r; + goto out_free_resources; if (ioc->is_warpdrive) { ioc->reply_post_host_index[0] = -- 2.39.5