From: Jesper Juhl Date: Tue, 31 Jul 2012 11:39:37 +0000 (+0000) Subject: bnx2x: fix mem leak when command is unknown X-Git-Tag: MMI-PSA29.97-13-9~16158^2~32 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8b6d5c09bc0c49aea041486d77c2f67e98ae0bc3;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git bnx2x: fix mem leak when command is unknown 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 Acked-by: Dmitry Kravkov Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 734fd87cd990..62f754bd0dfe 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; }