]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.0/net-fix-missing-meta-data-in-skb-with-vlan-packet.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.0 / net-fix-missing-meta-data-in-skb-with-vlan-packet.patch
1 From foo@baz Sat Apr 20 16:43:09 CEST 2019
2 From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
3 Date: Tue, 16 Apr 2019 10:22:28 +0900
4 Subject: net: Fix missing meta data in skb with vlan packet
5
6 From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
7
8 [ Upstream commit d85e8be2a5a02869f815dd0ac2d743deb4cd7957 ]
9
10 skb_reorder_vlan_header() should move XDP meta data with ethernet header
11 if XDP meta data exists.
12
13 Fixes: de8f3a83b0a0 ("bpf: add meta pointer for direct access")
14 Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
15 Signed-off-by: Takeru Hayasaka <taketarou2@gmail.com>
16 Co-developed-by: Takeru Hayasaka <taketarou2@gmail.com>
17 Reviewed-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 net/core/skbuff.c | 10 +++++++++-
22 1 file changed, 9 insertions(+), 1 deletion(-)
23
24 --- a/net/core/skbuff.c
25 +++ b/net/core/skbuff.c
26 @@ -5083,7 +5083,8 @@ EXPORT_SYMBOL_GPL(skb_gso_validate_mac_l
27
28 static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
29 {
30 - int mac_len;
31 + int mac_len, meta_len;
32 + void *meta;
33
34 if (skb_cow(skb, skb_headroom(skb)) < 0) {
35 kfree_skb(skb);
36 @@ -5095,6 +5096,13 @@ static struct sk_buff *skb_reorder_vlan_
37 memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb),
38 mac_len - VLAN_HLEN - ETH_TLEN);
39 }
40 +
41 + meta_len = skb_metadata_len(skb);
42 + if (meta_len) {
43 + meta = skb_metadata_end(skb) - meta_len;
44 + memmove(meta + VLAN_HLEN, meta, meta_len);
45 + }
46 +
47 skb->mac_header += VLAN_HLEN;
48 return skb;
49 }