]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: restore skb->sk before pskb_trim() call
authorEric Dumazet <edumazet@google.com>
Wed, 26 Apr 2017 16:09:23 +0000 (09:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 May 2017 02:23:16 +0000 (22:23 -0400)
commitced5209ff058238952846e423b206aacde309e7b
tree06b7b187db463b7e59a63e20498e5a57027399d1
parent582282a0b1ad23c999bc3a0997d760f93da19f95
bpf: restore skb->sk before pskb_trim() call

While testing a fix [1] in ___pskb_trim(), addressing the WARN_ON_ONCE()
in skb_try_coalesce() reported by Andrey, I found that we had an skb
with skb->sk set but no skb->destructor.

This invalidated heuristic found in commit 8e381bb20844 ("net: adjust
skb->truesize in pskb_expand_head()") and in cited patch.

Considering the BUG_ON(skb->sk) we have in skb_orphan(), we should
restrain the temporary setting to a minimal section.

[1] https://patchwork.ozlabs.org/patch/755570/
    net: adjust skb->truesize in ___pskb_trim()

Fixes: 034adad32b41 ("bpf: pass sk to helper functions")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/filter.c