]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: Make bpf_skb_vlan_pop helper metadata-safe
authorJakub Sitnicki <jakub@cloudflare.com>
Wed, 5 Nov 2025 20:19:42 +0000 (21:19 +0100)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 10 Nov 2025 18:52:31 +0000 (10:52 -0800)
Use the metadata-aware helper to move packet bytes after skb_pull(),
ensuring metadata remains valid after calling the BPF helper.

Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20251105-skb-meta-rx-path-v4-5-5ceb08a9b37b@cloudflare.com
include/linux/if_vlan.h

index afa5cc61a0fa9860195d9866d01c884cc9a65107..4ecc2509b0d431d5bc92c41cadf0ef1d0ba45c83 100644 (file)
@@ -738,9 +738,9 @@ static inline void vlan_remove_tag(struct sk_buff *skb, u16 *vlan_tci)
 
        *vlan_tci = ntohs(vhdr->h_vlan_TCI);
 
-       memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN);
        vlan_set_encap_proto(skb, vhdr);
        __skb_pull(skb, VLAN_HLEN);
+       skb_postpull_data_move(skb, VLAN_HLEN, 2 * ETH_ALEN);
 }
 
 /**