]> git.baikalelectronics.ru Git - kernel.git/commit
macvlan: Fix leaking skb in source mode with nodst option
authorMartin Willi <martin@strongswan.org>
Tue, 12 Apr 2022 09:34:57 +0000 (11:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2022 07:34:13 +0000 (09:34 +0200)
commit88f44c37d201d2d0bf50f0e81c97c1fcc55531c4
treea9eeae20c14f02554c28c3cb5620ec830f0e24b7
parent51c0ead63ab17d5fa7dfc272f6b9d4daf6fc0bdd
macvlan: Fix leaking skb in source mode with nodst option

[ Upstream commit 9b32a61e87504e7ffccd89d13b121c46d95dccdc ]

The MACVLAN receive handler clones skbs to all matching source MACVLAN
interfaces, before it passes the packet along to match on destination
based MACVLANs.

When using the MACVLAN nodst mode, passing the packet to destination based
MACVLANs is omitted and the handler returns with RX_HANDLER_CONSUMED.
However, the passed skb is not freed, leaking for any packet processed
with the nodst option.

Properly free the skb when consuming packets to fix that leak.

Fixes: b3fd925152f7 ("macvlan: Add nodst option to macvlan type source")
Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/macvlan.c