From: Eric Dumazet Date: Wed, 16 Nov 2016 14:31:52 +0000 (-0800) Subject: bnxt: add a missing rcu synchronization X-Git-Tag: v4.1.12-92~10^2~22 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c44a7122ad17023b3bb5497ab0f2966d4b9bc07c;p=users%2Fjedix%2Flinux-maple.git bnxt: add a missing rcu synchronization 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 Cc: Michael Chan Acked-by: Michael Chan Signed-off-by: David S. Miller (cherry picked from commit e5f6f564fd191d365fcd775c06a732a488205588) Signed-off-by: Brian Maly Signed-off-by: Dhaval Giani --- diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f165e659f37d..cfefeffdcece 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -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)