Message ID | 20240105235439.28282-4-michael.chan@broadcom.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d8214d0f0135010acf7205c646cda31601bbb7ad |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | bnxt_en: ntuple filter fixes | expand |
On Fri, Jan 05, 2024 at 03:54:39PM -0800, Michael Chan wrote: > 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> Thanks Michael, I agree that this addresses the issue flagged at the Link above. That it is a bug-fix, and should have a Fixes tag. And that as the cited commit has not propagated beyond net-next it is appropriate to target this patch at net-next. Reviewed-by: Simon Horman <horms@kernel.org>
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();
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> --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)