From: Roland Dreier <roland@kernel.org>
To: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>,
linux-scsi@vger.kernel.org
Subject: [PATCH] [SCSI] mpt2sas: Fix leak on mpt2sas_base_attach() error path
Date: Wed, 30 Nov 2011 17:14:22 -0800 [thread overview]
Message-ID: <1322702062-26952-1-git-send-email-roland@kernel.org> (raw)
From: Roland Dreier <roland@purestorage.com>
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 <roland@purestorage.com>
---
drivers/scsi/mpt2sas/mpt2sas_base.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index beda04a..a7b2a16 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -4206,7 +4206,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] =
--
1.7.5.4
next reply other threads:[~2011-12-01 1:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 1:14 Roland Dreier [this message]
2011-12-02 3:50 ` [PATCH] [SCSI] mpt2sas: Fix leak on mpt2sas_base_attach() error path Nandigama, Nagalakshmi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322702062-26952-1-git-send-email-roland@kernel.org \
--to=roland@kernel.org \
--cc=JBottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
--cc=nagalakshmi.nandigama@lsi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).