bnx2x: free the mac filter group list before freeing the cmd
authorjbaron@akamai.com <jbaron@akamai.com>
Mon, 26 Sep 2016 15:00:44 +0000 (11:00 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Sep 2016 13:55:18 +0000 (09:55 -0400)
The group list must be freed prior to freeing the command otherwise
we have a use-after-free.

Signed-off-by: Jason Baron <jbaron@akamai.com>
Cc: Yuval Mintz <Yuval.Mintz@qlogic.com>
Cc: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c

index 4947a9c..cea6bdc 100644 (file)
@@ -2714,8 +2714,8 @@ static int bnx2x_mcast_enqueue_cmd(struct bnx2x *bp,
                        elem_group = (struct bnx2x_mcast_elem_group *)
                                     __get_free_page(GFP_ATOMIC | __GFP_ZERO);
                        if (!elem_group) {
-                               kfree(new_cmd);
                                bnx2x_free_groups(&new_cmd->group_head);
+                               kfree(new_cmd);
                                return -ENOMEM;
                        }
                        total_elems -= MCAST_MAC_ELEMS_PER_PG;