]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ipvlan: Ignore PACKET_LOOPBACK in handle_mode_l2()
authorDmitry Skorodumov <skorodumov.dmitry@huawei.com>
Tue, 2 Dec 2025 10:39:03 +0000 (13:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:43 +0000 (13:09 +0100)
[ Upstream commit 0c57ff008a11f24f7f05fa760222692a00465fec ]

Packets with pkt_type == PACKET_LOOPBACK are captured by
handle_frame() function, but they don't have L2 header.
We should not process them in handle_mode_l2().

This doesn't affect old L2 functionality, since handling
was anyway incorrect.

Handle them the same way as in br_handle_frame():
just pass the skb.

To observe invalid behaviour, just start "ping -b" on bcast address
of port-interface.

Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
Link: https://patch.msgid.link/20251202103906.4087675-1-skorodumov.dmitry@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ipvlan/ipvlan_core.c

index a18b49db38ee008eb7bac6d944a92ed2cc2ed82f..35ec6d1af6ea6ee73fe96a3b5afcf1d2ded86461 100644 (file)
@@ -725,6 +725,9 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
        struct ethhdr *eth = eth_hdr(skb);
        rx_handler_result_t ret = RX_HANDLER_PASS;
 
+       if (unlikely(skb->pkt_type == PACKET_LOOPBACK))
+               return RX_HANDLER_PASS;
+
        if (is_multicast_ether_addr(eth->h_dest)) {
                if (ipvlan_external_frame(skb, port)) {
                        struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);