* [PATCH] bnx2x: fix mem leak when command is unknown
@ 2012-07-31 21:39 Jesper Juhl
2012-08-01 7:41 ` Dmitry Kravkov
2012-08-02 7:21 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Jesper Juhl @ 2012-07-31 21:39 UTC (permalink / raw)
To: Eilon Greenstein; +Cc: netdev, linux-kernel
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
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] bnx2x: fix mem leak when command is unknown
2012-07-31 21:39 [PATCH] bnx2x: fix mem leak when command is unknown Jesper Juhl
@ 2012-08-01 7:41 ` Dmitry Kravkov
2012-08-02 7:21 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Kravkov @ 2012-08-01 7:41 UTC (permalink / raw)
To: Jesper Juhl; +Cc: Eilon Greenstein, netdev, linux-kernel
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>
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] bnx2x: fix mem leak when command is unknown
2012-07-31 21:39 [PATCH] bnx2x: fix mem leak when command is unknown Jesper Juhl
2012-08-01 7:41 ` Dmitry Kravkov
@ 2012-08-02 7:21 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-08-02 7:21 UTC (permalink / raw)
To: jj; +Cc: eilong, netdev, linux-kernel
From: Jesper Juhl <jj@chaosbits.net>
Date: Tue, 31 Jul 2012 23:39:37 +0200 (CEST)
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-02 7:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-31 21:39 [PATCH] bnx2x: fix mem leak when command is unknown Jesper Juhl
2012-08-01 7:41 ` Dmitry Kravkov
2012-08-02 7:21 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox