]> 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)
commit0ea0e56b04cc6d4ce161db6ca1675abf9593bb1d
tree97357fd42503d008036961aa4a5b11bfed832920
parente249addf902aec351ee15bd0921ea81b7e46dbda
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: 5bd078f4a64d ("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