All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] netfilter: xt_hashlimit: fix lock imbalance
@ 2018-02-12 16:11 Eric Dumazet
  2018-02-14 16:41 ` Vishwanath Pai
  2018-02-16 14:00 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-02-12 16:11 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal; +Cc: Vishwanath Pai, netdev

From: Eric Dumazet <edumazet@google.com>

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 <edumazet@google.com>
Reported-by: syzkaller <syzkaller@googlegroups.com>
---
 net/netfilter/xt_hashlimit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index ca6847403ca218c478d208080aab3e3c92a0a615..1fea48b4182f7cd5669b9c5e7100b2735cc590e7 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] netfilter: xt_hashlimit: fix lock imbalance
  2018-02-12 16:11 [PATCH net] netfilter: xt_hashlimit: fix lock imbalance Eric Dumazet
@ 2018-02-14 16:41 ` Vishwanath Pai
  2018-02-16 14:00 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Vishwanath Pai @ 2018-02-14 16:41 UTC (permalink / raw)
  To: Eric Dumazet, Pablo Neira Ayuso, Florian Westphal; +Cc: netdev

On 02/12/2018 11:11 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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 <edumazet@google.com>
> Reported-by: syzkaller <syzkaller@googlegroups.com>
> ---
>  net/netfilter/xt_hashlimit.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
> index ca6847403ca218c478d208080aab3e3c92a0a615..1fea48b4182f7cd5669b9c5e7100b2735cc590e7 100644
> --- a/net/netfilter/xt_hashlimit.c
> +++ b/net/netfilter/xt_hashlimit.c
> @@ -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.

Acked-by: Vishwanath Pai <vpai@akamai.com>

-Vishwanath

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] netfilter: xt_hashlimit: fix lock imbalance
  2018-02-12 16:11 [PATCH net] netfilter: xt_hashlimit: fix lock imbalance Eric Dumazet
  2018-02-14 16:41 ` Vishwanath Pai
@ 2018-02-16 14:00 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2018-02-16 14:00 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Florian Westphal, Vishwanath Pai, netdev

On Mon, Feb 12, 2018 at 08:11:48AM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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.

[1] https://patchwork.ozlabs.org/project/netfilter-devel/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-16 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 16:11 [PATCH net] netfilter: xt_hashlimit: fix lock imbalance Eric Dumazet
2018-02-14 16:41 ` Vishwanath Pai
2018-02-16 14:00 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.