netfilter: xt_hashlimit: fix lock imbalance
Subsystems (3)
PATCH 1/1 netfilter: xt_hashlimit: fix lock imbalance
From: Eric Dumazet <[email protected]>
syszkaller found that rcu was not held in hashlimit_mt_common()
We only need to enable BH at this point.
---
net/netfilter/xt_hashlimit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_hashlimit.c +1 -1
@@ -774,7 +774,7 @@ hashlimit_mt_common(const struct sk_buff *skb, struct xt_action_param *par,if (!dh->rateinfo.prev_window && (dh->rateinfo.current_rate <= dh->rateinfo.burst)) {spin_unlock (&dh->lock); -rcu_read_unlock_bh (); +local_bh_enable ();return !(cfg->mode &XT_HASHLIMIT_INVERT ); }else { goto overlimit;
Quoted 19 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
syszkaller found that rcu was not held in
hashlimit_mt_common()We only need to enable BH at this point.
Fixes bea74641e378 ("netfilter: xt_hashlimit: add rate match mode")Signed-off-by Eric Dumazet <[email protected]>Reported-by syzkaller <[email protected]>---
net/netfilter/xt_hashlimit.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/netfilter/xt_hashlimit.c +0
-0
net/netfilter/xt_hashlimit.c hashlimit_mt_common(const struct sk_buff *skb, struct xt_action_param *par, · line 780
Quoted 8 lines
net/netfilter/xt_hashlimit.c +1
-1@@ -774,7 +774,7 @@ hashlimit_mt_common(const struct sk_buff *skb, struct xt_action_param *par,if (!dh->rateinfo.prev_window && (dh->rateinfo.current_rate <= dh->rateinfo.burst)) {spin_unlock (&dh->lock); -rcu_read_unlock_bh (); +local_bh_enable ();return !(cfg->mode &XT_HASHLIMIT_INVERT ); }else { goto overlimit;
Thanks for fixing this.
-Vishwanath
Quoted 5 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
syszkaller found that rcu was not held in
hashlimit_mt_common()We only need to enable BH at this point.
Applied, thanks Eric!
Sorry, this didn't get into my patchwork [1] for some reason, so it got lost.