bnx2x: Fix possible memory leak on iov error flow
authorYuval Mintz <Yuval.Mintz@qlogic.com>
Thu, 27 Mar 2014 11:46:37 +0000 (13:46 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Mar 2014 20:18:02 +0000 (16:18 -0400)
Commit 2dc33bbc4 "bnx2x: Remove the sriov VFOP mechanism" introduced a possible
memory leak on the error flow during multicast filters configuration.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c

index df1507288b3c739e1fc7ab77e2dc9204aca49174..5c523b32db70126720dbf0b2914dcbb1a3391a2b 100644 (file)
@@ -595,6 +595,8 @@ int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
        rc = bnx2x_config_mcast(bp, &mcast, BNX2X_MCAST_CMD_DEL);
        if (rc) {
                BNX2X_ERR("Failed to remove multicasts\n");
+               if (mc)
+                       kfree(mc);
                return rc;
        }