]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Oct 2023 06:13:13 +0000 (08:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Oct 2023 06:13:13 +0000 (08:13 +0200)
added patches:
dev_forward_skb-do-not-scrub-skb-mark-within-the-same-name-space.patch

queue-4.19/dev_forward_skb-do-not-scrub-skb-mark-within-the-same-name-space.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/dev_forward_skb-do-not-scrub-skb-mark-within-the-same-name-space.patch b/queue-4.19/dev_forward_skb-do-not-scrub-skb-mark-within-the-same-name-space.patch
new file mode 100644 (file)
index 0000000..d4c2eac
--- /dev/null
@@ -0,0 +1,45 @@
+From ff70202b2d1ad522275c6aadc8c53519b6a22c57 Mon Sep 17 00:00:00 2001
+From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
+Date: Thu, 24 Jun 2021 10:05:05 +0200
+Subject: dev_forward_skb: do not scrub skb mark within the same name space
+
+From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
+
+commit ff70202b2d1ad522275c6aadc8c53519b6a22c57 upstream.
+
+The goal is to keep the mark during a bpf_redirect(), like it is done for
+legacy encapsulation / decapsulation, when there is no x-netns.
+This was initially done in commit 213dd74aee76 ("skbuff: Do not scrub skb
+mark within the same name space").
+
+When the call to skb_scrub_packet() was added in dev_forward_skb() (commit
+8b27f27797ca ("skb: allow skb_scrub_packet() to be used by tunnels")), the
+second argument (xnet) was set to true to force a call to skb_orphan(). At
+this time, the mark was always cleanned up by skb_scrub_packet(), whatever
+xnet value was.
+This call to skb_orphan() was removed later in commit
+9c4c325252c5 ("skbuff: preserve sock reference when scrubbing the skb.").
+But this 'true' stayed here without any real reason.
+
+Let's correctly set xnet in ____dev_forward_skb(), this function has access
+to the previous interface and to the new interface.
+
+Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/netdevice.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/netdevice.h
++++ b/include/linux/netdevice.h
+@@ -3661,7 +3661,7 @@ static __always_inline int ____dev_forwa
+               return NET_RX_DROP;
+       }
+-      skb_scrub_packet(skb, true);
++      skb_scrub_packet(skb, !net_eq(dev_net(dev), dev_net(skb->dev)));
+       skb->priority = 0;
+       return 0;
+ }
index bbd72b80868d69753cea5159c75881be33824458..47aef3119ba71d1357794c741545f3a97f46a01d 100644 (file)
@@ -38,3 +38,4 @@ usb-gadget-udc-xilinx-replace-memcpy-with-memcpy_toio.patch
 usb-gadget-ncm-handle-decoding-of-multiple-ntb-s-in-unwrap-call.patch
 powerpc-64e-fix-wrong-test-in-__ptep_test_and_clear_.patch
 x86-alternatives-disable-kasan-in-apply_alternatives.patch
+dev_forward_skb-do-not-scrub-skb-mark-within-the-same-name-space.patch