]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_dup_netdev: do not push mac header a second time
authorFlorian Westphal <fw@strlen.de>
Mon, 20 Jun 2022 14:17:30 +0000 (16:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 21 Jun 2022 08:50:40 +0000 (10:50 +0200)
commitf9f4f14518b7490c71807a411ce16a5386db6241
tree97357fd42503d008036961aa4a5b11bfed832920
parent7920d8e7d4e7e9770d8cfe2ab51927f345ca38f1
netfilter: nf_dup_netdev: do not push mac header a second time

Eric reports skb_under_panic when using dup/fwd via bond+egress hook.
Before pushing mac header, we should make sure that we're called from
ingress to put back what was pulled earlier.

In egress case, the MAC header is already there; we should leave skb
alone.

While at it be more careful here: skb might have been altered and
headroom reduced, so add a skb_cow() before so that headroom is
increased if necessary.

nf_do_netdev_egress() assumes skb ownership (it normally ends with
a call to dev_queue_xmit), so we must free the packet on error.

Fixes: 2da1c50cc54c ("netfilter: nft_fwd_netdev: Support egress hook")
Reported-by: Eric Garver <eric@garver.life>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_dup_netdev.c