From: Roland Dreier <rdreier@cisco.com>
To: linux-kernel@vger.kernel.org,
"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Subject: [PATCH] [SCSI] target: Fix memory leak on error path
Date: Sat, 15 Jan 2011 21:42:32 -0800 [thread overview]
Message-ID: <ada1v4d1k1j.fsf@cisco.com> (raw)
If allocation of pt->pscsi_cdb fails, we need to free the just-allocated
pt or else it will be leaked.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
---
drivers/target/target_core_pscsi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 742d246..60a2509 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -817,6 +817,7 @@ pscsi_alloc_task(struct se_cmd *cmd)
if (!(pt->pscsi_cdb)) {
printk(KERN_ERR "pSCSI: Unable to allocate extended"
" pt->pscsi_cdb\n");
+ kfree(pt);
return NULL;
}
} else
next reply other threads:[~2011-01-16 5:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-16 5:42 Roland Dreier [this message]
2011-01-16 7:09 ` [PATCH] [SCSI] target: Fix memory leak on error path Nicholas A. Bellinger
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=ada1v4d1k1j.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.