diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-08-17 17:22:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-17 10:25:18 -0700 |
commit | 976d28bfd1f62a3f8e5370c5e7127ff5b3499359 (patch) | |
tree | 772b86c56604fa18395437281ce0861522369daf | |
parent | 8c37bc677af3458dd5598d22467fb913f31c5bb2 (diff) | |
download | linux-976d28bfd1f62a3f8e5370c5e7127ff5b3499359.tar.bz2 |
bpf: don't enable preemption twice in smap_do_verdict
In smap_do_verdict(), the fall-through branch leads to call
preempt_enable() twice for the SK_REDIRECT, which creates an
imbalance. Only enable it for all remaining cases again.
Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | kernel/bpf/sockmap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index f7e5e6cf124a..39de541fbcdc 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -135,7 +135,8 @@ static void smap_do_verdict(struct smap_psock *psock, struct sk_buff *skb) /* Fall through and free skb otherwise */ case SK_DROP: default: - preempt_enable(); + if (rc != SK_REDIRECT) + preempt_enable(); kfree_skb(skb); } } |