summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorMichael Chan <michael.chan@broadcom.com>2024-01-05 15:54:39 -0800
committerJakub Kicinski <kuba@kernel.org>2024-01-08 19:15:03 -0800
commitd8214d0f0135010acf7205c646cda31601bbb7ad (patch)
treecc888883ef7cf850d3dda96d603295764da0ecf2 /drivers/net
parentfd7769798de8a3748c286da65d7e32437f9854bf (diff)
bnxt_en: Fix RCU locking for ntuple filters in bnxt_rx_flow_steer()
Similar to the previous patch, RCU locking was released too early in bnxt_rx_flow_steer(). Fix it to unlock after reading fltr->base.sw_id to guarantee that fltr won't be freed while we are still reading it. Fixes: cb5bdd292dc0 ("bnxt_en: Add bnxt_lookup_ntp_filter_from_idx() function") Reported-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/netdev/20231225165653.GH5962@kernel.org/ Signed-off-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20240105235439.28282-4-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index fb5af8a34c8f..0aacd3c6ed5c 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -14020,8 +14020,8 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
rcu_read_lock();
fltr = bnxt_lookup_ntp_filter_from_idx(bp, new_fltr, idx);
if (fltr) {
- rcu_read_unlock();
rc = fltr->base.sw_id;
+ rcu_read_unlock();
goto err_free;
}
rcu_read_unlock();