]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Dec 2020 09:30:36 +0000 (10:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Dec 2020 09:30:36 +0000 (10:30 +0100)
added patches:
cxgb3-fix-error-return-code-in-t3_sge_alloc_qset.patch
dt-bindings-net-correct-interrupt-flags-in-examples.patch
ibmvnic-ensure-that-scrq-entry-reads-are-correctly-ordered.patch
ibmvnic-fix-tx-completion-error-handling.patch
ipv4-fix-tos-mask-in-inet_rtm_getroute.patch
net-mlx5-fix-wrong-address-reclaim-when-command-interface-is-down.patch
net-pasemi-fix-error-return-code-in-pasemi_mac_open.patch
net-x25-prevent-a-couple-of-overflows.patch
netfilter-bridge-reset-skb-pkt_type-after-nf_inet_post_routing-traversal.patch

queue-4.14/cxgb3-fix-error-return-code-in-t3_sge_alloc_qset.patch [new file with mode: 0644]
queue-4.14/dt-bindings-net-correct-interrupt-flags-in-examples.patch [new file with mode: 0644]
queue-4.14/ibmvnic-ensure-that-scrq-entry-reads-are-correctly-ordered.patch [new file with mode: 0644]
queue-4.14/ibmvnic-fix-tx-completion-error-handling.patch [new file with mode: 0644]
queue-4.14/ipv4-fix-tos-mask-in-inet_rtm_getroute.patch [new file with mode: 0644]
queue-4.14/net-mlx5-fix-wrong-address-reclaim-when-command-interface-is-down.patch [new file with mode: 0644]
queue-4.14/net-pasemi-fix-error-return-code-in-pasemi_mac_open.patch [new file with mode: 0644]
queue-4.14/net-x25-prevent-a-couple-of-overflows.patch [new file with mode: 0644]
queue-4.14/netfilter-bridge-reset-skb-pkt_type-after-nf_inet_post_routing-traversal.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/cxgb3-fix-error-return-code-in-t3_sge_alloc_qset.patch b/queue-4.14/cxgb3-fix-error-return-code-in-t3_sge_alloc_qset.patch
new file mode 100644 (file)
index 0000000..72f709e
--- /dev/null
@@ -0,0 +1,33 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Zhang Changzhong <zhangchangzhong@huawei.com>
+Date: Wed, 2 Dec 2020 17:56:05 +0800
+Subject: cxgb3: fix error return code in t3_sge_alloc_qset()
+
+From: Zhang Changzhong <zhangchangzhong@huawei.com>
+
+[ Upstream commit ff9924897f8bfed82e61894b373ab9d2dfea5b10 ]
+
+Fix to return a negative error code from the error handling
+case instead of 0, as done elsewhere in this function.
+
+Fixes: b1fb1f280d09 ("cxgb3 - Fix dma mapping error path")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
+Acked-by: Raju Rangoju <rajur@chelsio.com>
+Link: https://lore.kernel.org/r/1606902965-1646-1-git-send-email-zhangchangzhong@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/chelsio/cxgb3/sge.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
+@@ -3111,6 +3111,7 @@ int t3_sge_alloc_qset(struct adapter *ad
+                         GFP_KERNEL | __GFP_COMP);
+       if (!avail) {
+               CH_ALERT(adapter, "free list queue 0 initialization failed\n");
++              ret = -ENOMEM;
+               goto err;
+       }
+       if (avail < q->fl[0].size)
diff --git a/queue-4.14/dt-bindings-net-correct-interrupt-flags-in-examples.patch b/queue-4.14/dt-bindings-net-correct-interrupt-flags-in-examples.patch
new file mode 100644 (file)
index 0000000..af71342
--- /dev/null
@@ -0,0 +1,56 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Krzysztof Kozlowski <krzk@kernel.org>
+Date: Mon, 26 Oct 2020 16:36:20 +0100
+Subject: dt-bindings: net: correct interrupt flags in examples
+
+From: Krzysztof Kozlowski <krzk@kernel.org>
+
+[ Upstream commit 4d521943f76bd0d1e68ea5e02df7aadd30b2838a ]
+
+GPIO_ACTIVE_x flags are not correct in the context of interrupt flags.
+These are simple defines so they could be used in DTS but they will not
+have the same meaning:
+1. GPIO_ACTIVE_HIGH = 0 = IRQ_TYPE_NONE
+2. GPIO_ACTIVE_LOW  = 1 = IRQ_TYPE_EDGE_RISING
+
+Correct the interrupt flags, assuming the author of the code wanted same
+logical behavior behind the name "ACTIVE_xxx", this is:
+  ACTIVE_LOW  => IRQ_TYPE_LEVEL_LOW
+  ACTIVE_HIGH => IRQ_TYPE_LEVEL_HIGH
+
+Fixes: a1a8b4594f8d ("NFC: pn544: i2c: Add DTS Documentation")
+Fixes: 6be88670fc59 ("NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver")
+Fixes: e3b329221567 ("dt-bindings: can: tcan4x5x: Update binding to use interrupt property")
+Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
+Acked-by: Rob Herring <robh@kernel.org>
+Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for tcan4x5x.txt
+Link: https://lore.kernel.org/r/20201026153620.89268-1-krzk@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/devicetree/bindings/net/nfc/nxp-nci.txt |    2 +-
+ Documentation/devicetree/bindings/net/nfc/pn544.txt   |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt
++++ b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt
+@@ -26,7 +26,7 @@ Example (for ARM-based BeagleBone with N
+               clock-frequency = <100000>;
+               interrupt-parent = <&gpio1>;
+-              interrupts = <29 GPIO_ACTIVE_HIGH>;
++              interrupts = <29 IRQ_TYPE_LEVEL_HIGH>;
+               enable-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
+               firmware-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
+--- a/Documentation/devicetree/bindings/net/nfc/pn544.txt
++++ b/Documentation/devicetree/bindings/net/nfc/pn544.txt
+@@ -26,7 +26,7 @@ Example (for ARM-based BeagleBone with P
+               clock-frequency = <400000>;
+               interrupt-parent = <&gpio1>;
+-              interrupts = <17 GPIO_ACTIVE_HIGH>;
++              interrupts = <17 IRQ_TYPE_LEVEL_HIGH>;
+               enable-gpios = <&gpio3 21 GPIO_ACTIVE_HIGH>;
+               firmware-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
diff --git a/queue-4.14/ibmvnic-ensure-that-scrq-entry-reads-are-correctly-ordered.patch b/queue-4.14/ibmvnic-ensure-that-scrq-entry-reads-are-correctly-ordered.patch
new file mode 100644 (file)
index 0000000..a082e01
--- /dev/null
@@ -0,0 +1,66 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Thomas Falcon <tlfalcon@linux.ibm.com>
+Date: Tue, 1 Dec 2020 09:52:10 -0600
+Subject: ibmvnic: Ensure that SCRQ entry reads are correctly ordered
+
+From: Thomas Falcon <tlfalcon@linux.ibm.com>
+
+[ Upstream commit b71ec952234610b4f90ef17a2fdcb124d5320070 ]
+
+Ensure that received Subordinate Command-Response Queue (SCRQ)
+entries are properly read in order by the driver. These queues
+are used in the ibmvnic device to process RX buffer and TX completion
+descriptors. dma_rmb barriers have been added after checking for a
+pending descriptor to ensure the correct descriptor entry is checked
+and after reading the SCRQ descriptor to ensure the entire
+descriptor is read before processing.
+
+Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
+Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c |   18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -1658,6 +1658,12 @@ restart_poll:
+               if (!pending_scrq(adapter, adapter->rx_scrq[scrq_num]))
+                       break;
++              /* The queue entry at the current index is peeked at above
++               * to determine that there is a valid descriptor awaiting
++               * processing. We want to be sure that the current slot
++               * holds a valid descriptor before reading its contents.
++               */
++              dma_rmb();
+               next = ibmvnic_next_scrq(adapter, adapter->rx_scrq[scrq_num]);
+               rx_buff =
+                   (struct ibmvnic_rx_buff *)be64_to_cpu(next->
+@@ -2177,6 +2183,13 @@ restart_loop:
+       while (pending_scrq(adapter, scrq)) {
+               unsigned int pool = scrq->pool_index;
++              /* The queue entry at the current index is peeked at above
++               * to determine that there is a valid descriptor awaiting
++               * processing. We want to be sure that the current slot
++               * holds a valid descriptor before reading its contents.
++               */
++              dma_rmb();
++
+               next = ibmvnic_next_scrq(adapter, scrq);
+               for (i = 0; i < next->tx_comp.num_comps; i++) {
+                       if (next->tx_comp.rcs[i]) {
+@@ -2530,6 +2543,11 @@ static union sub_crq *ibmvnic_next_scrq(
+       }
+       spin_unlock_irqrestore(&scrq->lock, flags);
++      /* Ensure that the entire buffer descriptor has been
++       * loaded before reading its contents
++       */
++      dma_rmb();
++
+       return entry;
+ }
diff --git a/queue-4.14/ibmvnic-fix-tx-completion-error-handling.patch b/queue-4.14/ibmvnic-fix-tx-completion-error-handling.patch
new file mode 100644 (file)
index 0000000..386b26b
--- /dev/null
@@ -0,0 +1,37 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Thomas Falcon <tlfalcon@linux.ibm.com>
+Date: Tue, 1 Dec 2020 09:52:11 -0600
+Subject: ibmvnic: Fix TX completion error handling
+
+From: Thomas Falcon <tlfalcon@linux.ibm.com>
+
+[ Upstream commit ba246c175116e2e8fa4fdfa5f8e958e086a9a818 ]
+
+TX completions received with an error return code are not
+being processed properly. When an error code is seen, do not
+proceed to the next completion before cleaning up the existing
+entry's data structures.
+
+Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
+Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -2192,11 +2192,9 @@ restart_loop:
+               next = ibmvnic_next_scrq(adapter, scrq);
+               for (i = 0; i < next->tx_comp.num_comps; i++) {
+-                      if (next->tx_comp.rcs[i]) {
++                      if (next->tx_comp.rcs[i])
+                               dev_err(dev, "tx error %x\n",
+                                       next->tx_comp.rcs[i]);
+-                              continue;
+-                      }
+                       index = be32_to_cpu(next->tx_comp.correlators[i]);
+                       txbuff = &adapter->tx_pool[pool].tx_buff[index];
diff --git a/queue-4.14/ipv4-fix-tos-mask-in-inet_rtm_getroute.patch b/queue-4.14/ipv4-fix-tos-mask-in-inet_rtm_getroute.patch
new file mode 100644 (file)
index 0000000..4b227d6
--- /dev/null
@@ -0,0 +1,70 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Guillaume Nault <gnault@redhat.com>
+Date: Thu, 26 Nov 2020 19:09:22 +0100
+Subject: ipv4: Fix tos mask in inet_rtm_getroute()
+
+From: Guillaume Nault <gnault@redhat.com>
+
+[ Upstream commit 1ebf179037cb46c19da3a9c1e2ca16e7a754b75e ]
+
+When inet_rtm_getroute() was converted to use the RCU variants of
+ip_route_input() and ip_route_output_key(), the TOS parameters
+stopped being masked with IPTOS_RT_MASK before doing the route lookup.
+
+As a result, "ip route get" can return a different route than what
+would be used when sending real packets.
+
+For example:
+
+    $ ip route add 192.0.2.11/32 dev eth0
+    $ ip route add unreachable 192.0.2.11/32 tos 2
+    $ ip route get 192.0.2.11 tos 2
+    RTNETLINK answers: No route to host
+
+But, packets with TOS 2 (ECT(0) if interpreted as an ECN bit) would
+actually be routed using the first route:
+
+    $ ping -c 1 -Q 2 192.0.2.11
+    PING 192.0.2.11 (192.0.2.11) 56(84) bytes of data.
+    64 bytes from 192.0.2.11: icmp_seq=1 ttl=64 time=0.173 ms
+
+    --- 192.0.2.11 ping statistics ---
+    1 packets transmitted, 1 received, 0% packet loss, time 0ms
+    rtt min/avg/max/mdev = 0.173/0.173/0.173/0.000 ms
+
+This patch re-applies IPTOS_RT_MASK in inet_rtm_getroute(), to
+return results consistent with real route lookups.
+
+Fixes: 3765d35ed8b9 ("net: ipv4: Convert inet_rtm_getroute to rcu versions of route lookup")
+Signed-off-by: Guillaume Nault <gnault@redhat.com>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Link: https://lore.kernel.org/r/b2d237d08317ca55926add9654a48409ac1b8f5b.1606412894.git.gnault@redhat.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/route.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/net/ipv4/route.c
++++ b/net/ipv4/route.c
+@@ -2788,7 +2788,7 @@ static int inet_rtm_getroute(struct sk_b
+       memset(&fl4, 0, sizeof(fl4));
+       fl4.daddr = dst;
+       fl4.saddr = src;
+-      fl4.flowi4_tos = rtm->rtm_tos;
++      fl4.flowi4_tos = rtm->rtm_tos & IPTOS_RT_MASK;
+       fl4.flowi4_oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0;
+       fl4.flowi4_mark = mark;
+       fl4.flowi4_uid = uid;
+@@ -2807,8 +2807,9 @@ static int inet_rtm_getroute(struct sk_b
+               skb->protocol   = htons(ETH_P_IP);
+               skb->dev        = dev;
+               skb->mark       = mark;
+-              err = ip_route_input_rcu(skb, dst, src, rtm->rtm_tos,
+-                                       dev, &res);
++              err = ip_route_input_rcu(skb, dst, src,
++                                       rtm->rtm_tos & IPTOS_RT_MASK, dev,
++                                       &res);
+               rt = skb_rtable(skb);
+               if (err == 0 && rt->dst.error)
diff --git a/queue-4.14/net-mlx5-fix-wrong-address-reclaim-when-command-interface-is-down.patch b/queue-4.14/net-mlx5-fix-wrong-address-reclaim-when-command-interface-is-down.patch
new file mode 100644 (file)
index 0000000..c5560ec
--- /dev/null
@@ -0,0 +1,62 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Eran Ben Elisha <eranbe@nvidia.com>
+Date: Wed, 2 Dec 2020 20:39:43 -0800
+Subject: net/mlx5: Fix wrong address reclaim when command interface is down
+
+From: Eran Ben Elisha <eranbe@nvidia.com>
+
+[ Upstream commit 1d2bb5ad89f47d8ce8aedc70ef85059ab3870292 ]
+
+When command interface is down, driver to reclaim all 4K page chucks that
+were hold by the Firmeware. Fix a bug for 64K page size systems, where
+driver repeatedly released only the first chunk of the page.
+
+Define helper function to fill 4K chunks for a given Firmware pages.
+Iterate over all unreleased Firmware pages and call the hepler per each.
+
+Fixes: 5adff6a08862 ("net/mlx5: Fix incorrect page count when in internal error")
+Signed-off-by: Eran Ben Elisha <eranbe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c |   21 ++++++++++++++++++--
+ 1 file changed, 19 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+@@ -331,6 +331,24 @@ out_free:
+       return err;
+ }
++static u32 fwp_fill_manage_pages_out(struct fw_page *fwp, u32 *out, u32 index,
++                                   u32 npages)
++{
++      u32 pages_set = 0;
++      unsigned int n;
++
++      for_each_clear_bit(n, &fwp->bitmask, MLX5_NUM_4K_IN_PAGE) {
++              MLX5_ARRAY_SET64(manage_pages_out, out, pas, index + pages_set,
++                               fwp->addr + (n * MLX5_ADAPTER_PAGE_SIZE));
++              pages_set++;
++
++              if (!--npages)
++                      break;
++      }
++
++      return pages_set;
++}
++
+ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
+                            u32 *in, int in_size, u32 *out, int out_size)
+ {
+@@ -354,8 +372,7 @@ static int reclaim_pages_cmd(struct mlx5
+               if (fwp->func_id != func_id)
+                       continue;
+-              MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr);
+-              i++;
++              i += fwp_fill_manage_pages_out(fwp, out, i, npages - i);
+       }
+       MLX5_SET(manage_pages_out, out, output_num_entries, i);
diff --git a/queue-4.14/net-pasemi-fix-error-return-code-in-pasemi_mac_open.patch b/queue-4.14/net-pasemi-fix-error-return-code-in-pasemi_mac_open.patch
new file mode 100644 (file)
index 0000000..313dc8b
--- /dev/null
@@ -0,0 +1,48 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Zhang Changzhong <zhangchangzhong@huawei.com>
+Date: Wed, 2 Dec 2020 17:57:15 +0800
+Subject: net: pasemi: fix error return code in pasemi_mac_open()
+
+From: Zhang Changzhong <zhangchangzhong@huawei.com>
+
+[ Upstream commit aba84871bd4f52c4dfcf3ad5d4501a6c9d2de90e ]
+
+Fix to return a negative error code from the error handling
+case instead of 0, as done elsewhere in this function.
+
+Fixes: 72b05b9940f0 ("pasemi_mac: RX/TX ring management cleanup")
+Fixes: 8d636d8bc5ff ("pasemi_mac: jumbo frame support")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
+Link: https://lore.kernel.org/r/1606903035-1838-1-git-send-email-zhangchangzhong@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/pasemi/pasemi_mac.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
++++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
+@@ -1089,16 +1089,20 @@ static int pasemi_mac_open(struct net_de
+       mac->tx = pasemi_mac_setup_tx_resources(dev);
+-      if (!mac->tx)
++      if (!mac->tx) {
++              ret = -ENOMEM;
+               goto out_tx_ring;
++      }
+       /* We might already have allocated rings in case mtu was changed
+        * before interface was brought up.
+        */
+       if (dev->mtu > 1500 && !mac->num_cs) {
+               pasemi_mac_setup_csrings(mac);
+-              if (!mac->num_cs)
++              if (!mac->num_cs) {
++                      ret = -ENOMEM;
+                       goto out_tx_ring;
++              }
+       }
+       /* Zero out rmon counters */
diff --git a/queue-4.14/net-x25-prevent-a-couple-of-overflows.patch b/queue-4.14/net-x25-prevent-a-couple-of-overflows.patch
new file mode 100644 (file)
index 0000000..7bc917f
--- /dev/null
@@ -0,0 +1,59 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Tue, 1 Dec 2020 18:15:12 +0300
+Subject: net/x25: prevent a couple of overflows
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 6ee50c8e262a0f0693dad264c3c99e30e6442a56 ]
+
+The .x25_addr[] address comes from the user and is not necessarily
+NUL terminated.  This leads to a couple problems.  The first problem is
+that the strlen() in x25_bind() can read beyond the end of the buffer.
+
+The second problem is more subtle and could result in memory corruption.
+The call tree is:
+  x25_connect()
+  --> x25_write_internal()
+      --> x25_addr_aton()
+
+The .x25_addr[] buffers are copied to the "addresses" buffer from
+x25_write_internal() so it will lead to stack corruption.
+
+Verify that the strings are NUL terminated and return -EINVAL if they
+are not.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Fixes: a9288525d2ae ("X25: Dont let x25_bind use addresses containing characters")
+Reported-by: "kiyin(尹亮)" <kiyin@tencent.com>
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Acked-by: Martin Schiller <ms@dev.tdt.de>
+Link: https://lore.kernel.org/r/X8ZeAKm8FnFpN//B@mwanda
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/x25/af_x25.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/net/x25/af_x25.c
++++ b/net/x25/af_x25.c
+@@ -679,7 +679,8 @@ static int x25_bind(struct socket *sock,
+       int len, i, rc = 0;
+       if (addr_len != sizeof(struct sockaddr_x25) ||
+-          addr->sx25_family != AF_X25) {
++          addr->sx25_family != AF_X25 ||
++          strnlen(addr->sx25_addr.x25_addr, X25_ADDR_LEN) == X25_ADDR_LEN) {
+               rc = -EINVAL;
+               goto out;
+       }
+@@ -773,7 +774,8 @@ static int x25_connect(struct socket *so
+       rc = -EINVAL;
+       if (addr_len != sizeof(struct sockaddr_x25) ||
+-          addr->sx25_family != AF_X25)
++          addr->sx25_family != AF_X25 ||
++          strnlen(addr->sx25_addr.x25_addr, X25_ADDR_LEN) == X25_ADDR_LEN)
+               goto out;
+       rc = -ENETUNREACH;
diff --git a/queue-4.14/netfilter-bridge-reset-skb-pkt_type-after-nf_inet_post_routing-traversal.patch b/queue-4.14/netfilter-bridge-reset-skb-pkt_type-after-nf_inet_post_routing-traversal.patch
new file mode 100644 (file)
index 0000000..8f59ba1
--- /dev/null
@@ -0,0 +1,84 @@
+From foo@baz Sun Dec  6 10:26:08 AM CET 2020
+From: Antoine Tenart <atenart@kernel.org>
+Date: Mon, 23 Nov 2020 18:49:02 +0100
+Subject: netfilter: bridge: reset skb->pkt_type after NF_INET_POST_ROUTING traversal
+
+From: Antoine Tenart <atenart@kernel.org>
+
+[ Upstream commit 44f64f23bae2f0fad25503bc7ab86cd08d04cd47 ]
+
+Netfilter changes PACKET_OTHERHOST to PACKET_HOST before invoking the
+hooks as, while it's an expected value for a bridge, routing expects
+PACKET_HOST. The change is undone later on after hook traversal. This
+can be seen with pairs of functions updating skb>pkt_type and then
+reverting it to its original value:
+
+For hook NF_INET_PRE_ROUTING:
+  setup_pre_routing / br_nf_pre_routing_finish
+
+For hook NF_INET_FORWARD:
+  br_nf_forward_ip / br_nf_forward_finish
+
+But the third case where netfilter does this, for hook
+NF_INET_POST_ROUTING, the packet type is changed in br_nf_post_routing
+but never reverted. A comment says:
+
+  /* We assume any code from br_dev_queue_push_xmit onwards doesn't care
+   * about the value of skb->pkt_type. */
+
+But when having a tunnel (say vxlan) attached to a bridge we have the
+following call trace:
+
+  br_nf_pre_routing
+  br_nf_pre_routing_ipv6
+     br_nf_pre_routing_finish
+  br_nf_forward_ip
+     br_nf_forward_finish
+  br_nf_post_routing           <- pkt_type is updated to PACKET_HOST
+     br_nf_dev_queue_xmit      <- but not reverted to its original value
+  vxlan_xmit
+     vxlan_xmit_one
+        skb_tunnel_check_pmtu  <- a check on pkt_type is performed
+
+In this specific case, this creates issues such as when an ICMPv6 PTB
+should be sent back. When CONFIG_BRIDGE_NETFILTER is enabled, the PTB
+isn't sent (as skb_tunnel_check_pmtu checks if pkt_type is PACKET_HOST
+and returns early).
+
+If the comment is right and no one cares about the value of
+skb->pkt_type after br_dev_queue_push_xmit (which isn't true), resetting
+it to its original value should be safe.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Antoine Tenart <atenart@kernel.org>
+Reviewed-by: Florian Westphal <fw@strlen.de>
+Link: https://lore.kernel.org/r/20201123174902.622102-1-atenart@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/bridge/br_netfilter_hooks.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/net/bridge/br_netfilter_hooks.c
++++ b/net/bridge/br_netfilter_hooks.c
+@@ -716,6 +716,11 @@ static int br_nf_dev_queue_xmit(struct n
+       mtu_reserved = nf_bridge_mtu_reduction(skb);
+       mtu = skb->dev->mtu;
++      if (nf_bridge->pkt_otherhost) {
++              skb->pkt_type = PACKET_OTHERHOST;
++              nf_bridge->pkt_otherhost = false;
++      }
++
+       if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu)
+               mtu = nf_bridge->frag_max_size;
+@@ -809,8 +814,6 @@ static unsigned int br_nf_post_routing(v
+       else
+               return NF_ACCEPT;
+-      /* We assume any code from br_dev_queue_push_xmit onwards doesn't care
+-       * about the value of skb->pkt_type. */
+       if (skb->pkt_type == PACKET_OTHERHOST) {
+               skb->pkt_type = PACKET_HOST;
+               nf_bridge->pkt_otherhost = true;
index afdc27194021a15bba7476ed3883e330ac619cbf..01eb481e904d4f879a68a90b7e85621733c8e99b 100644 (file)
@@ -5,3 +5,12 @@ tcp-set-inet_ecn_xmit-configuration-in-tcp_reinit_congestion_control.patch
 tun-honor-iocb_nowait-flag.patch
 usbnet-ipheth-fix-connectivity-with-ios-14.patch
 bonding-wait-for-sysfs-kobject-destruction-before-freeing-struct-slave.patch
+netfilter-bridge-reset-skb-pkt_type-after-nf_inet_post_routing-traversal.patch
+ipv4-fix-tos-mask-in-inet_rtm_getroute.patch
+ibmvnic-ensure-that-scrq-entry-reads-are-correctly-ordered.patch
+ibmvnic-fix-tx-completion-error-handling.patch
+net-x25-prevent-a-couple-of-overflows.patch
+cxgb3-fix-error-return-code-in-t3_sge_alloc_qset.patch
+net-pasemi-fix-error-return-code-in-pasemi_mac_open.patch
+net-mlx5-fix-wrong-address-reclaim-when-command-interface-is-down.patch
+dt-bindings-net-correct-interrupt-flags-in-examples.patch