From: adam radford <aradford@gmail.com>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: Neela Syam Kolli <megaraidlinux@lsi.com>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] megaraid_sas: fix memory leak if SGL has zero length entries
Date: Mon, 3 Dec 2012 17:49:23 -0800 [thread overview]
Message-ID: <CAHtARFF0jGrd-7a5Jh16GK60SYBCP7f5Fg2=c8bb7K13aMneRQ@mail.gmail.com> (raw)
In-Reply-To: <1353488088-10684-1-git-send-email-bjorn@mork.no>
On Wed, Nov 21, 2012 at 12:54 AM, Bjørn Mork <bjorn@mork.no> wrote:
> commit 98cb7e44 ([SCSI] megaraid_sas: Sanity check user
> supplied length before passing it to dma_alloc_coherent())
> introduced a memory leak. Memory allocated for entries
> following zero length SGL entries will not be freed.
>
> Reference: http://bugs.debian.org/688198
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> ---
> drivers/scsi/megaraid/megaraid_sas_base.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index d2c5366..12b6be4 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -4854,10 +4854,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
> sense, sense_handle);
> }
>
> - for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
> - dma_free_coherent(&instance->pdev->dev,
> - kern_sge32[i].length,
> - kbuff_arr[i], kern_sge32[i].phys_addr);
> + for (i = 0; i < ioc->sge_count; i++) {
> + if (kbuff_arr[i])
> + dma_free_coherent(&instance->pdev->dev,
> + kern_sge32[i].length,
> + kbuff_arr[i],
> + kern_sge32[i].phys_addr);
> }
>
> megasas_return_cmd(instance, cmd);
Acked-by: Adam Radford <aradford@gmail.com>
next prev parent reply other threads:[~2012-12-04 1:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 8:54 [PATCH] megaraid_sas: fix memory leak if SGL has zero length entries Bjørn Mork
2012-12-04 1:49 ` adam radford [this message]
2013-06-29 14:15 ` Bjørn Mork
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='CAHtARFF0jGrd-7a5Jh16GK60SYBCP7f5Fg2=c8bb7K13aMneRQ@mail.gmail.com' \
--to=aradford@gmail.com \
--cc=JBottomley@parallels.com \
--cc=bjorn@mork.no \
--cc=linux-scsi@vger.kernel.org \
--cc=megaraidlinux@lsi.com \
--cc=stable@vger.kernel.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 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).