netfilter: xt_hashlimit: fix lock imbalance
authorEric Dumazet <edumazet@google.com>
Mon, 12 Feb 2018 16:11:48 +0000 (08:11 -0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 16 Feb 2018 14:00:55 +0000 (15:00 +0100)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_hashlimit.c

index aa96027..66f5aca 100644 (file)
@@ -775,7 +775,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;