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
6 From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
8 [ Upstream commit d85e8be2a5a02869f815dd0ac2d743deb4cd7957 ]
10 skb_reorder_vlan_header() should move XDP meta data with ethernet header
11 if XDP meta data exists.
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>
21 net/core/skbuff.c | 10 +++++++++-
22 1 file changed, 9 insertions(+), 1 deletion(-)
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
28 static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
31 + int mac_len, meta_len;
34 if (skb_cow(skb, skb_headroom(skb)) < 0) {
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);
41 + meta_len = skb_metadata_len(skb);
43 + meta = skb_metadata_end(skb) - meta_len;
44 + memmove(meta + VLAN_HLEN, meta, meta_len);
47 skb->mac_header += VLAN_HLEN;