From: "Dmitry Kravkov" <dmitry@broadcom.com>
To: "Jesper Juhl" <jj@chaosbits.net>
Cc: "Eilon Greenstein" <eilong@broadcom.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bnx2x: fix mem leak when command is unknown
Date: Wed, 1 Aug 2012 10:41:17 +0300 [thread overview]
Message-ID: <1343806877.834.3.camel@lb-tlvb-dmitry.il.broadcom.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1207312337590.7100@swampdragon.chaosbits.net>
On Tue, 2012-07-31 at 23:39 +0200, Jesper Juhl wrote:
> In bnx2x_mcast_enqueue_cmd() we'll leak the memory allocated to
> 'new_cmd' if we hit the deafault case of the 'switch (cmd)'.
> Add a 'kfree(new_cmd)' to that case to avoid the leak.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> note: due to lack of hardware this patch is compile tested only.
>
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
> index 734fd87..62f754b 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
> @@ -2485,6 +2485,7 @@ static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp,
> break;
>
> default:
> + kfree(new_cmd);
> BNX2X_ERR("Unknown command: %d\n", cmd);
> return -EINVAL;
> }
> --
> 1.7.11.3
>
Thanks a lot, Jesper.
Acked-by: Dmitry Kravkov <dmitry@broadcom.com>
>
next prev parent reply other threads:[~2012-08-01 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 21:39 [PATCH] bnx2x: fix mem leak when command is unknown Jesper Juhl
2012-08-01 7:41 ` Dmitry Kravkov [this message]
2012-08-02 7:21 ` David Miller
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=1343806877.834.3.camel@lb-tlvb-dmitry.il.broadcom.com \
--to=dmitry@broadcom.com \
--cc=eilong@broadcom.com \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@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