]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt: add a missing rcu synchronization
authorEric Dumazet <edumazet@google.com>
Wed, 16 Nov 2016 14:31:52 +0000 (06:31 -0800)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 18:08:03 +0000 (13:08 -0500)
Orabug: 24567991

Add a missing synchronize_net() call to avoid potential use after free,
since we explicitly call napi_hash_del() to factorize the RCU grace
period.

Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Michael Chan <michael.chan@broadcom.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e5f6f564fd191d365fcd775c06a732a488205588)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index f165e659f37d90aeb0d97b293a50015b277a0c13..cfefeffdceced29291db4333bad408d9df4d93e1 100644 (file)
@@ -4947,6 +4947,10 @@ static void bnxt_del_napi(struct bnxt *bp)
                napi_hash_del(&bnapi->napi);
                netif_napi_del(&bnapi->napi);
        }
+       /* We called napi_hash_del() before netif_napi_del(), we need
+        * to respect an RCU grace period before freeing napi structures.
+        */
+       synchronize_net();
 }
 
 static void bnxt_init_napi(struct bnxt *bp)