mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
bnxt_en: Fix RCU locking for ntuple filters in bnxt_srxclsrldel()
After looking up an ntuple filter from a RCU hash list, the
rcu_read_unlock() call should be made after reading the structure,
or after determining that the filter cannot age out (by aRFS).
The existing code was calling rcu_read_unlock() too early in
bnxt_srxclsrldel().
As suggested by Simon Horman, change the code to handle the error
case of fltr_base not found in the if condition. The code looks
cleaner this way.
Fixes: 8d7ba028aa
("bnxt_en: Add support for ntuple filter deletion by ethtool.")
Suggested-by: Simon Horman <horms@kernel.org>
Reported-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/netdev/20240104145955.5a6df702@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-3-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1ef4cacaae
commit
fd7769798d
1 changed files with 11 additions and 10 deletions
|
@ -1345,25 +1345,26 @@ static int bnxt_srxclsrldel(struct bnxt *bp, struct ethtool_rxnfc *cmd)
|
|||
{
|
||||
struct ethtool_rx_flow_spec *fs = &cmd->fs;
|
||||
struct bnxt_filter_base *fltr_base;
|
||||
struct bnxt_ntuple_filter *fltr;
|
||||
|
||||
rcu_read_lock();
|
||||
fltr_base = bnxt_get_one_fltr_rcu(bp, bp->ntp_fltr_hash_tbl,
|
||||
BNXT_NTP_FLTR_HASH_SIZE,
|
||||
fs->location);
|
||||
if (fltr_base) {
|
||||
struct bnxt_ntuple_filter *fltr;
|
||||
|
||||
fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
|
||||
if (!fltr_base) {
|
||||
rcu_read_unlock();
|
||||
if (!(fltr->base.flags & BNXT_ACT_NO_AGING))
|
||||
return -EINVAL;
|
||||
bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
|
||||
bnxt_del_ntp_filter(bp, fltr);
|
||||
return 0;
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base);
|
||||
if (!(fltr->base.flags & BNXT_ACT_NO_AGING)) {
|
||||
rcu_read_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
return -ENOENT;
|
||||
bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr);
|
||||
bnxt_del_ntp_filter(bp, fltr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u64 get_ethtool_ipv4_rss(struct bnxt *bp)
|
||||
|
|
Loading…
Add table
Reference in a new issue