]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Sat, 12 Mar 2022 08:51:02 +0000 (03:51 -0500)
committerSasha Levin <sashal@kernel.org>
Sat, 12 Mar 2022 08:51:02 +0000 (03:51 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
16 files changed:
queue-4.14/ax25-fix-null-pointer-dereference-in-ax25_kill_by_de.patch [new file with mode: 0644]
queue-4.14/ethernet-fix-error-handling-in-xemaclite_of_probe.patch [new file with mode: 0644]
queue-4.14/gpio-ts4900-do-not-set-dat-and-oe-together.patch [new file with mode: 0644]
queue-4.14/net-ethernet-lpc_eth-handle-error-for-clk_enable.patch [new file with mode: 0644]
queue-4.14/net-ethernet-ti-cpts-handle-error-for-clk_enable.patch [new file with mode: 0644]
queue-4.14/net-mlx5-fix-size-field-in-bufferx_reg-struct.patch [new file with mode: 0644]
queue-4.14/net-qlogic-check-the-return-value-of-dma_alloc_coher.patch [new file with mode: 0644]
queue-4.14/net-sysfs-add-check-for-netdevice-being-present-to-s.patch [new file with mode: 0644]
queue-4.14/nfc-port100-fix-use-after-free-in-port100_send_compl.patch [new file with mode: 0644]
queue-4.14/qed-return-status-of-qed_iov_get_link.patch [new file with mode: 0644]
queue-4.14/revert-xen-netback-check-for-hotplug-status-existenc.patch [new file with mode: 0644]
queue-4.14/revert-xen-netback-remove-hotplug-status-once-it-has.patch [new file with mode: 0644]
queue-4.14/sctp-fix-kernel-infoleak-for-sctp-sockets.patch [new file with mode: 0644]
queue-4.14/selftests-memfd-clean-up-mapping-in-mfd_fail_write.patch [new file with mode: 0644]
queue-4.14/series [new file with mode: 0644]
queue-4.14/tracing-ensure-trace-buffer-is-at-least-4096-bytes-l.patch [new file with mode: 0644]

diff --git a/queue-4.14/ax25-fix-null-pointer-dereference-in-ax25_kill_by_de.patch b/queue-4.14/ax25-fix-null-pointer-dereference-in-ax25_kill_by_de.patch
new file mode 100644 (file)
index 0000000..c8d87ec
--- /dev/null
@@ -0,0 +1,65 @@
+From 1ccb631049e9f2b122251ea1f4e51079ee2bffa8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Mar 2022 16:12:23 +0800
+Subject: ax25: Fix NULL pointer dereference in ax25_kill_by_device
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 71171ac8eb34ce7fe6b3267dce27c313ab3cb3ac ]
+
+When two ax25 devices attempted to establish connection, the requester use ax25_create(),
+ax25_bind() and ax25_connect() to initiate connection. The receiver use ax25_rcv() to
+accept connection and use ax25_create_cb() in ax25_rcv() to create ax25_cb, but the
+ax25_cb->sk is NULL. When the receiver is detaching, a NULL pointer dereference bug
+caused by sock_hold(sk) in ax25_kill_by_device() will happen. The corresponding
+fail log is shown below:
+
+===============================================================
+BUG: KASAN: null-ptr-deref in ax25_device_event+0xfd/0x290
+Call Trace:
+...
+ax25_device_event+0xfd/0x290
+raw_notifier_call_chain+0x5e/0x70
+dev_close_many+0x174/0x220
+unregister_netdevice_many+0x1f7/0xa60
+unregister_netdevice_queue+0x12f/0x170
+unregister_netdev+0x13/0x20
+mkiss_close+0xcd/0x140
+tty_ldisc_release+0xc0/0x220
+tty_release_struct+0x17/0xa0
+tty_release+0x62d/0x670
+...
+
+This patch add condition check in ax25_kill_by_device(). If s->sk is
+NULL, it will goto if branch to kill device.
+
+Fixes: 4e0f718daf97 ("ax25: improve the incomplete fix to avoid UAF and NPD bugs")
+Reported-by: Thomas Osterried <thomas@osterried.de>
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ax25/af_ax25.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
+index 36d2e1dfa1e6..466f9e3883c8 100644
+--- a/net/ax25/af_ax25.c
++++ b/net/ax25/af_ax25.c
+@@ -90,6 +90,13 @@ static void ax25_kill_by_device(struct net_device *dev)
+       ax25_for_each(s, &ax25_list) {
+               if (s->ax25_dev == ax25_dev) {
+                       sk = s->sk;
++                      if (!sk) {
++                              spin_unlock_bh(&ax25_list_lock);
++                              s->ax25_dev = NULL;
++                              ax25_disconnect(s, ENETUNREACH);
++                              spin_lock_bh(&ax25_list_lock);
++                              goto again;
++                      }
+                       sock_hold(sk);
+                       spin_unlock_bh(&ax25_list_lock);
+                       lock_sock(sk);
+-- 
+2.34.1
+
diff --git a/queue-4.14/ethernet-fix-error-handling-in-xemaclite_of_probe.patch b/queue-4.14/ethernet-fix-error-handling-in-xemaclite_of_probe.patch
new file mode 100644 (file)
index 0000000..9c098ff
--- /dev/null
@@ -0,0 +1,48 @@
+From cb495d8c37fb8756ba0da9a99b866dfacbd271ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Mar 2022 02:47:49 +0000
+Subject: ethernet: Fix error handling in xemaclite_of_probe
+
+From: Miaoqian Lin <linmq006@gmail.com>
+
+[ Upstream commit b19ab4b38b06aae12442b2de95ccf58b5dc53584 ]
+
+This node pointer is returned by of_parse_phandle() with refcount
+incremented in this function. Calling of_node_put() to avoid the
+refcount leak. As the remove function do.
+
+Fixes: 5cdaaa12866e ("net: emaclite: adding MDIO and phy lib support")
+Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://lore.kernel.org/r/20220308024751.2320-1-linmq006@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+index 5261796ce708..d83e6743f156 100644
+--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+@@ -1161,7 +1161,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
+       if (rc) {
+               dev_err(dev,
+                       "Cannot register network device, aborting\n");
+-              goto error;
++              goto put_node;
+       }
+       dev_info(dev,
+@@ -1169,6 +1169,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
+                (unsigned int __force)ndev->mem_start, lp->base_addr, ndev->irq);
+       return 0;
++put_node:
++      of_node_put(lp->phy_node);
+ error:
+       free_netdev(ndev);
+       return rc;
+-- 
+2.34.1
+
diff --git a/queue-4.14/gpio-ts4900-do-not-set-dat-and-oe-together.patch b/queue-4.14/gpio-ts4900-do-not-set-dat-and-oe-together.patch
new file mode 100644 (file)
index 0000000..688f758
--- /dev/null
@@ -0,0 +1,82 @@
+From dcb32d903f6745ba2ecc7071c2ab1ca7f387311f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Mar 2022 17:16:16 -0800
+Subject: gpio: ts4900: Do not set DAT and OE together
+
+From: Mark Featherston <mark@embeddedTS.com>
+
+[ Upstream commit 03fe003547975680fdb9ff5ab0e41cb68276c4f2 ]
+
+This works around an issue with the hardware where both OE and
+DAT are exposed in the same register. If both are updated
+simultaneously, the harware makes no guarantees that OE or DAT
+will actually change in any given order and may result in a
+glitch of a few ns on a GPIO pin when changing direction and value
+in a single write.
+
+Setting direction to input now only affects OE bit. Setting
+direction to output updates DAT first, then OE.
+
+Fixes: 9c6686322d74 ("gpio: add Technologic I2C-FPGA gpio support")
+Signed-off-by: Mark Featherston <mark@embeddedTS.com>
+Signed-off-by: Kris Bahnsen <kris@embeddedTS.com>
+Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpio/gpio-ts4900.c | 24 +++++++++++++++++++-----
+ 1 file changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpio/gpio-ts4900.c b/drivers/gpio/gpio-ts4900.c
+index 5bd21725e604..930a6098b758 100644
+--- a/drivers/gpio/gpio-ts4900.c
++++ b/drivers/gpio/gpio-ts4900.c
+@@ -1,7 +1,7 @@
+ /*
+  * Digital I/O driver for Technologic Systems I2C FPGA Core
+  *
+- * Copyright (C) 2015 Technologic Systems
++ * Copyright (C) 2015, 2018 Technologic Systems
+  * Copyright (C) 2016 Savoir-Faire Linux
+  *
+  * This program is free software; you can redistribute it and/or
+@@ -52,19 +52,33 @@ static int ts4900_gpio_direction_input(struct gpio_chip *chip,
+ {
+       struct ts4900_gpio_priv *priv = gpiochip_get_data(chip);
+-      /*
+-       * This will clear the output enable bit, the other bits are
+-       * dontcare when this is cleared
++      /* Only clear the OE bit here, requires a RMW. Prevents potential issue
++       * with OE and data getting to the physical pin at different times.
+        */
+-      return regmap_write(priv->regmap, offset, 0);
++      return regmap_update_bits(priv->regmap, offset, TS4900_GPIO_OE, 0);
+ }
+ static int ts4900_gpio_direction_output(struct gpio_chip *chip,
+                                       unsigned int offset, int value)
+ {
+       struct ts4900_gpio_priv *priv = gpiochip_get_data(chip);
++      unsigned int reg;
+       int ret;
++      /* If changing from an input to an output, we need to first set the
++       * proper data bit to what is requested and then set OE bit. This
++       * prevents a glitch that can occur on the IO line
++       */
++      regmap_read(priv->regmap, offset, &reg);
++      if (!(reg & TS4900_GPIO_OE)) {
++              if (value)
++                      reg = TS4900_GPIO_OUT;
++              else
++                      reg &= ~TS4900_GPIO_OUT;
++
++              regmap_write(priv->regmap, offset, reg);
++      }
++
+       if (value)
+               ret = regmap_write(priv->regmap, offset, TS4900_GPIO_OE |
+                                                        TS4900_GPIO_OUT);
+-- 
+2.34.1
+
diff --git a/queue-4.14/net-ethernet-lpc_eth-handle-error-for-clk_enable.patch b/queue-4.14/net-ethernet-lpc_eth-handle-error-for-clk_enable.patch
new file mode 100644 (file)
index 0000000..5e57930
--- /dev/null
@@ -0,0 +1,47 @@
+From 5e1448cb396ec1e7298d76103e2228de74d5ae94 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Mar 2022 14:57:39 +0800
+Subject: net: ethernet: lpc_eth: Handle error for clk_enable
+
+From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+
+[ Upstream commit 2169b79258c8be803d2595d6456b1e77129fe154 ]
+
+As the potential failure of the clk_enable(),
+it should be better to check it and return error
+if fails.
+
+Fixes: b7370112f519 ("lpc32xx: Added ethernet driver")
+Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/nxp/lpc_eth.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
+index 415ac33341c5..27c22f0e9d25 100644
+--- a/drivers/net/ethernet/nxp/lpc_eth.c
++++ b/drivers/net/ethernet/nxp/lpc_eth.c
+@@ -1512,6 +1512,7 @@ static int lpc_eth_drv_resume(struct platform_device *pdev)
+ {
+       struct net_device *ndev = platform_get_drvdata(pdev);
+       struct netdata_local *pldat;
++      int ret;
+       if (device_may_wakeup(&pdev->dev))
+               disable_irq_wake(ndev->irq);
+@@ -1521,7 +1522,9 @@ static int lpc_eth_drv_resume(struct platform_device *pdev)
+                       pldat = netdev_priv(ndev);
+                       /* Enable interface clock */
+-                      clk_enable(pldat->clk);
++                      ret = clk_enable(pldat->clk);
++                      if (ret)
++                              return ret;
+                       /* Reset and initialize */
+                       __lpc_eth_reset(pldat);
+-- 
+2.34.1
+
diff --git a/queue-4.14/net-ethernet-ti-cpts-handle-error-for-clk_enable.patch b/queue-4.14/net-ethernet-ti-cpts-handle-error-for-clk_enable.patch
new file mode 100644 (file)
index 0000000..dc27cb4
--- /dev/null
@@ -0,0 +1,39 @@
+From 8c5a8dbe751cb9782d296fc3f495934f6a9325e4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Mar 2022 14:40:07 +0800
+Subject: net: ethernet: ti: cpts: Handle error for clk_enable
+
+From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+
+[ Upstream commit 6babfc6e6fab068018c36e8f6605184b8c0b349d ]
+
+As the potential failure of the clk_enable(),
+it should be better to check it and return error
+if fails.
+
+Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization")
+Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ti/cpts.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
+index 9e7e7e8a018d..232662cbc26a 100644
+--- a/drivers/net/ethernet/ti/cpts.c
++++ b/drivers/net/ethernet/ti/cpts.c
+@@ -440,7 +440,9 @@ int cpts_register(struct cpts *cpts)
+       for (i = 0; i < CPTS_MAX_EVENTS; i++)
+               list_add(&cpts->pool_data[i].list, &cpts->pool);
+-      clk_enable(cpts->refclk);
++      err = clk_enable(cpts->refclk);
++      if (err)
++              return err;
+       cpts_write32(cpts, CPTS_EN, control);
+       cpts_write32(cpts, TS_PEND_EN, int_enable);
+-- 
+2.34.1
+
diff --git a/queue-4.14/net-mlx5-fix-size-field-in-bufferx_reg-struct.patch b/queue-4.14/net-mlx5-fix-size-field-in-bufferx_reg-struct.patch
new file mode 100644 (file)
index 0000000..258116c
--- /dev/null
@@ -0,0 +1,39 @@
+From 33e17df587f51992a260d006c64fcc69f41bf195 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Mar 2021 14:38:55 +0200
+Subject: net/mlx5: Fix size field in bufferx_reg struct
+
+From: Mohammad Kabat <mohammadkab@nvidia.com>
+
+[ Upstream commit ac77998b7ac3044f0509b097da9637184598980d ]
+
+According to HW spec the field "size" should be 16 bits
+in bufferx register.
+
+Fixes: e281682bf294 ("net/mlx5_core: HW data structs/types definitions cleanup")
+Signed-off-by: Mohammad Kabat <mohammadkab@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/mlx5/mlx5_ifc.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
+index c4b8602ea6f5..e0eed46e4039 100644
+--- a/include/linux/mlx5/mlx5_ifc.h
++++ b/include/linux/mlx5/mlx5_ifc.h
+@@ -7953,8 +7953,8 @@ struct mlx5_ifc_bufferx_reg_bits {
+       u8         reserved_at_0[0x6];
+       u8         lossy[0x1];
+       u8         epsb[0x1];
+-      u8         reserved_at_8[0xc];
+-      u8         size[0xc];
++      u8         reserved_at_8[0x8];
++      u8         size[0x10];
+       u8         xoff_threshold[0x10];
+       u8         xon_threshold[0x10];
+-- 
+2.34.1
+
diff --git a/queue-4.14/net-qlogic-check-the-return-value-of-dma_alloc_coher.patch b/queue-4.14/net-qlogic-check-the-return-value-of-dma_alloc_coher.patch
new file mode 100644 (file)
index 0000000..7439508
--- /dev/null
@@ -0,0 +1,50 @@
+From 3595719133d62438167341501db8c51c1d698516 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 5 Mar 2022 01:14:11 -0800
+Subject: net: qlogic: check the return value of dma_alloc_coherent() in
+ qed_vf_hw_prepare()
+
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+
+[ Upstream commit e0058f0fa80f6e09c4d363779c241c45a3c56b94 ]
+
+The function dma_alloc_coherent() in qed_vf_hw_prepare() can fail, so
+its return value should be checked.
+
+Fixes: 1408cc1fa48c ("qed: Introduce VFs")
+Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
+Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/qlogic/qed/qed_vf.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
+index 693f2a039383..848a6574c0b2 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
+@@ -539,6 +539,9 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
+                                                   p_iov->bulletin.size,
+                                                   &p_iov->bulletin.phys,
+                                                   GFP_KERNEL);
++      if (!p_iov->bulletin.p_virt)
++              goto free_pf2vf_reply;
++
+       DP_VERBOSE(p_hwfn, QED_MSG_IOV,
+                  "VF's bulletin Board [%p virt 0x%llx phys 0x%08x bytes]\n",
+                  p_iov->bulletin.p_virt,
+@@ -578,6 +581,10 @@ int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
+       return rc;
++free_pf2vf_reply:
++      dma_free_coherent(&p_hwfn->cdev->pdev->dev,
++                        sizeof(union pfvf_tlvs),
++                        p_iov->pf2vf_reply, p_iov->pf2vf_reply_phys);
+ free_vf2pf_request:
+       dma_free_coherent(&p_hwfn->cdev->pdev->dev,
+                         sizeof(union vfpf_tlvs),
+-- 
+2.34.1
+
diff --git a/queue-4.14/net-sysfs-add-check-for-netdevice-being-present-to-s.patch b/queue-4.14/net-sysfs-add-check-for-netdevice-being-present-to-s.patch
new file mode 100644 (file)
index 0000000..8c14e9b
--- /dev/null
@@ -0,0 +1,78 @@
+From bf2509e68cbc106ba4d4bb821a19491ffb4fb1bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 17 Feb 2022 07:25:18 +0530
+Subject: net-sysfs: add check for netdevice being present to speed_show
+
+From: suresh kumar <suresh2514@gmail.com>
+
+[ Upstream commit 4224cfd7fb6523f7a9d1c8bb91bb5df1e38eb624 ]
+
+When bringing down the netdevice or system shutdown, a panic can be
+triggered while accessing the sysfs path because the device is already
+removed.
+
+    [  755.549084] mlx5_core 0000:12:00.1: Shutdown was called
+    [  756.404455] mlx5_core 0000:12:00.0: Shutdown was called
+    ...
+    [  757.937260] BUG: unable to handle kernel NULL pointer dereference at           (null)
+    [  758.031397] IP: [<ffffffff8ee11acb>] dma_pool_alloc+0x1ab/0x280
+
+    crash> bt
+    ...
+    PID: 12649  TASK: ffff8924108f2100  CPU: 1   COMMAND: "amsd"
+    ...
+     #9 [ffff89240e1a38b0] page_fault at ffffffff8f38c778
+        [exception RIP: dma_pool_alloc+0x1ab]
+        RIP: ffffffff8ee11acb  RSP: ffff89240e1a3968  RFLAGS: 00010046
+        RAX: 0000000000000246  RBX: ffff89243d874100  RCX: 0000000000001000
+        RDX: 0000000000000000  RSI: 0000000000000246  RDI: ffff89243d874090
+        RBP: ffff89240e1a39c0   R8: 000000000001f080   R9: ffff8905ffc03c00
+        R10: ffffffffc04680d4  R11: ffffffff8edde9fd  R12: 00000000000080d0
+        R13: ffff89243d874090  R14: ffff89243d874080  R15: 0000000000000000
+        ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
+    #10 [ffff89240e1a39c8] mlx5_alloc_cmd_msg at ffffffffc04680f3 [mlx5_core]
+    #11 [ffff89240e1a3a18] cmd_exec at ffffffffc046ad62 [mlx5_core]
+    #12 [ffff89240e1a3ab8] mlx5_cmd_exec at ffffffffc046b4fb [mlx5_core]
+    #13 [ffff89240e1a3ae8] mlx5_core_access_reg at ffffffffc0475434 [mlx5_core]
+    #14 [ffff89240e1a3b40] mlx5e_get_fec_caps at ffffffffc04a7348 [mlx5_core]
+    #15 [ffff89240e1a3bb0] get_fec_supported_advertised at ffffffffc04992bf [mlx5_core]
+    #16 [ffff89240e1a3c08] mlx5e_get_link_ksettings at ffffffffc049ab36 [mlx5_core]
+    #17 [ffff89240e1a3ce8] __ethtool_get_link_ksettings at ffffffff8f25db46
+    #18 [ffff89240e1a3d48] speed_show at ffffffff8f277208
+    #19 [ffff89240e1a3dd8] dev_attr_show at ffffffff8f0b70e3
+    #20 [ffff89240e1a3df8] sysfs_kf_seq_show at ffffffff8eedbedf
+    #21 [ffff89240e1a3e18] kernfs_seq_show at ffffffff8eeda596
+    #22 [ffff89240e1a3e28] seq_read at ffffffff8ee76d10
+    #23 [ffff89240e1a3e98] kernfs_fop_read at ffffffff8eedaef5
+    #24 [ffff89240e1a3ed8] vfs_read at ffffffff8ee4e3ff
+    #25 [ffff89240e1a3f08] sys_read at ffffffff8ee4f27f
+    #26 [ffff89240e1a3f50] system_call_fastpath at ffffffff8f395f92
+
+    crash> net_device.state ffff89443b0c0000
+      state = 0x5  (__LINK_STATE_START| __LINK_STATE_NOCARRIER)
+
+To prevent this scenario, we also make sure that the netdevice is present.
+
+Signed-off-by: suresh kumar <suresh2514@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/net-sysfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
+index 7d8c6ba5cbd2..5ff47c5bc453 100644
+--- a/net/core/net-sysfs.c
++++ b/net/core/net-sysfs.c
+@@ -202,7 +202,7 @@ static ssize_t speed_show(struct device *dev,
+       if (!rtnl_trylock())
+               return restart_syscall();
+-      if (netif_running(netdev)) {
++      if (netif_running(netdev) && netif_device_present(netdev)) {
+               struct ethtool_link_ksettings cmd;
+               if (!__ethtool_get_link_ksettings(netdev, &cmd))
+-- 
+2.34.1
+
diff --git a/queue-4.14/nfc-port100-fix-use-after-free-in-port100_send_compl.patch b/queue-4.14/nfc-port100-fix-use-after-free-in-port100_send_compl.patch
new file mode 100644 (file)
index 0000000..fe069c3
--- /dev/null
@@ -0,0 +1,86 @@
+From cbc588cf022013e0176be07f2d756e0e3326e396 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 8 Mar 2022 21:50:07 +0300
+Subject: NFC: port100: fix use-after-free in port100_send_complete
+
+From: Pavel Skripkin <paskripkin@gmail.com>
+
+[ Upstream commit f80cfe2f26581f188429c12bd937eb905ad3ac7b ]
+
+Syzbot reported UAF in port100_send_complete(). The root case is in
+missing usb_kill_urb() calls on error handling path of ->probe function.
+
+port100_send_complete() accesses devm allocated memory which will be
+freed on probe failure. We should kill this urbs before returning an
+error from probe function to prevent reported use-after-free
+
+Fail log:
+
+BUG: KASAN: use-after-free in port100_send_complete+0x16e/0x1a0 drivers/nfc/port100.c:935
+Read of size 1 at addr ffff88801bb59540 by task ksoftirqd/2/26
+...
+Call Trace:
+ <TASK>
+ __dump_stack lib/dump_stack.c:88 [inline]
+ dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
+ print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255
+ __kasan_report mm/kasan/report.c:442 [inline]
+ kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
+ port100_send_complete+0x16e/0x1a0 drivers/nfc/port100.c:935
+ __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1670
+
+...
+
+Allocated by task 1255:
+ kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
+ kasan_set_track mm/kasan/common.c:45 [inline]
+ set_alloc_info mm/kasan/common.c:436 [inline]
+ ____kasan_kmalloc mm/kasan/common.c:515 [inline]
+ ____kasan_kmalloc mm/kasan/common.c:474 [inline]
+ __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524
+ alloc_dr drivers/base/devres.c:116 [inline]
+ devm_kmalloc+0x96/0x1d0 drivers/base/devres.c:823
+ devm_kzalloc include/linux/device.h:209 [inline]
+ port100_probe+0x8a/0x1320 drivers/nfc/port100.c:1502
+
+Freed by task 1255:
+ kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
+ kasan_set_track+0x21/0x30 mm/kasan/common.c:45
+ kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
+ ____kasan_slab_free mm/kasan/common.c:366 [inline]
+ ____kasan_slab_free+0xff/0x140 mm/kasan/common.c:328
+ kasan_slab_free include/linux/kasan.h:236 [inline]
+ __cache_free mm/slab.c:3437 [inline]
+ kfree+0xf8/0x2b0 mm/slab.c:3794
+ release_nodes+0x112/0x1a0 drivers/base/devres.c:501
+ devres_release_all+0x114/0x190 drivers/base/devres.c:530
+ really_probe+0x626/0xcc0 drivers/base/dd.c:670
+
+Reported-and-tested-by: syzbot+16bcb127fb73baeecb14@syzkaller.appspotmail.com
+Fixes: 0347a6ab300a ("NFC: port100: Commands mechanism implementation")
+Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+Link: https://lore.kernel.org/r/20220308185007.6987-1-paskripkin@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nfc/port100.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c
+index 0f37acec98ab..bc680b8be133 100644
+--- a/drivers/nfc/port100.c
++++ b/drivers/nfc/port100.c
+@@ -1618,7 +1618,9 @@ static int port100_probe(struct usb_interface *interface,
+       nfc_digital_free_device(dev->nfc_digital_dev);
+ error:
++      usb_kill_urb(dev->in_urb);
+       usb_free_urb(dev->in_urb);
++      usb_kill_urb(dev->out_urb);
+       usb_free_urb(dev->out_urb);
+       usb_put_dev(dev->udev);
+-- 
+2.34.1
+
diff --git a/queue-4.14/qed-return-status-of-qed_iov_get_link.patch b/queue-4.14/qed-return-status-of-qed_iov_get_link.patch
new file mode 100644 (file)
index 0000000..7339318
--- /dev/null
@@ -0,0 +1,87 @@
+From c864c135ec7495aa0207f2c4a5c67786245b6ab8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 5 Mar 2022 07:06:42 -0800
+Subject: qed: return status of qed_iov_get_link
+
+From: Tom Rix <trix@redhat.com>
+
+[ Upstream commit d9dc0c84ad2d4cc911ba252c973d1bf18d5eb9cf ]
+
+Clang static analysis reports this issue
+qed_sriov.c:4727:19: warning: Assigned value is
+  garbage or undefined
+  ivi->max_tx_rate = tx_rate ? tx_rate : link.speed;
+                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+link is only sometimes set by the call to qed_iov_get_link()
+qed_iov_get_link fails without setting link or returning
+status.  So change the decl to return status.
+
+Fixes: 73390ac9d82b ("qed*: support ndo_get_vf_config")
+Signed-off-by: Tom Rix <trix@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/qlogic/qed/qed_sriov.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
+index bc9eec1bcbf1..5e7e977c62b6 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
+@@ -3782,11 +3782,11 @@ bool qed_iov_mark_vf_flr(struct qed_hwfn *p_hwfn, u32 *p_disabled_vfs)
+       return found;
+ }
+-static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
+-                           u16 vfid,
+-                           struct qed_mcp_link_params *p_params,
+-                           struct qed_mcp_link_state *p_link,
+-                           struct qed_mcp_link_capabilities *p_caps)
++static int qed_iov_get_link(struct qed_hwfn *p_hwfn,
++                          u16 vfid,
++                          struct qed_mcp_link_params *p_params,
++                          struct qed_mcp_link_state *p_link,
++                          struct qed_mcp_link_capabilities *p_caps)
+ {
+       struct qed_vf_info *p_vf = qed_iov_get_vf_info(p_hwfn,
+                                                      vfid,
+@@ -3794,7 +3794,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
+       struct qed_bulletin_content *p_bulletin;
+       if (!p_vf)
+-              return;
++              return -EINVAL;
+       p_bulletin = p_vf->bulletin.p_virt;
+@@ -3804,6 +3804,7 @@ static void qed_iov_get_link(struct qed_hwfn *p_hwfn,
+               __qed_vf_get_link_state(p_hwfn, p_link, p_bulletin);
+       if (p_caps)
+               __qed_vf_get_link_caps(p_hwfn, p_caps, p_bulletin);
++      return 0;
+ }
+ static void qed_iov_process_mbx_req(struct qed_hwfn *p_hwfn,
+@@ -4554,6 +4555,7 @@ static int qed_get_vf_config(struct qed_dev *cdev,
+       struct qed_public_vf_info *vf_info;
+       struct qed_mcp_link_state link;
+       u32 tx_rate;
++      int ret;
+       /* Sanitize request */
+       if (IS_VF(cdev))
+@@ -4567,7 +4569,9 @@ static int qed_get_vf_config(struct qed_dev *cdev,
+       vf_info = qed_iov_get_public_vf_info(hwfn, vf_id, true);
+-      qed_iov_get_link(hwfn, vf_id, NULL, &link, NULL);
++      ret = qed_iov_get_link(hwfn, vf_id, NULL, &link, NULL);
++      if (ret)
++              return ret;
+       /* Fill information about VF */
+       ivi->vf = vf_id;
+-- 
+2.34.1
+
diff --git a/queue-4.14/revert-xen-netback-check-for-hotplug-status-existenc.patch b/queue-4.14/revert-xen-netback-check-for-hotplug-status-existenc.patch
new file mode 100644 (file)
index 0000000..0735845
--- /dev/null
@@ -0,0 +1,68 @@
+From c1d6625e81280bb04010005895bc2294703bc667 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Feb 2022 01:18:17 +0100
+Subject: Revert "xen-netback: Check for hotplug-status existence before
+ watching"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
+
+[ Upstream commit e8240addd0a3919e0fd7436416afe9aa6429c484 ]
+
+This reverts commit 2afeec08ab5c86ae21952151f726bfe184f6b23d.
+
+The reasoning in the commit was wrong - the code expected to setup the
+watch even if 'hotplug-status' didn't exist. In fact, it relied on the
+watch being fired the first time - to check if maybe 'hotplug-status' is
+already set to 'connected'. Not registering a watch for non-existing
+path (which is the case if hotplug script hasn't been executed yet),
+made the backend not waiting for the hotplug script to execute. This in
+turns, made the netfront think the interface is fully operational, while
+in fact it was not (the vif interface on xen-netback side might not be
+configured yet).
+
+This was a workaround for 'hotplug-status' erroneously being removed.
+But since that is reverted now, the workaround is not necessary either.
+
+More discussion at
+https://lore.kernel.org/xen-devel/afedd7cb-a291-e773-8b0d-4db9b291fa98@ipxe.org/T/#u
+
+Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
+Reviewed-by: Paul Durrant <paul@xen.org>
+Reviewed-by: Michael Brown <mbrown@fensystems.co.uk>
+Link: https://lore.kernel.org/r/20220222001817.2264967-2-marmarek@invisiblethingslab.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/xen-netback/xenbus.c | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index df2e1ec9e624..37b662f0eebc 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -1044,15 +1044,11 @@ static void connect(struct backend_info *be)
+       xenvif_carrier_on(be->vif);
+       unregister_hotplug_status_watch(be);
+-      if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) {
+-              err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
+-                                         NULL, hotplug_status_changed,
+-                                         "%s/%s", dev->nodename,
+-                                         "hotplug-status");
+-              if (err)
+-                      goto err;
++      err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
++                                 hotplug_status_changed,
++                                 "%s/%s", dev->nodename, "hotplug-status");
++      if (!err)
+               be->have_hotplug_status_watch = 1;
+-      }
+       netif_tx_wake_all_queues(be->vif->dev);
+-- 
+2.34.1
+
diff --git a/queue-4.14/revert-xen-netback-remove-hotplug-status-once-it-has.patch b/queue-4.14/revert-xen-netback-remove-hotplug-status-once-it-has.patch
new file mode 100644 (file)
index 0000000..7c0ebe5
--- /dev/null
@@ -0,0 +1,58 @@
+From 2f5fc8a06cc6cbed299eb2d96f9b77f8b327d1d3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 22 Feb 2022 01:18:16 +0100
+Subject: Revert "xen-netback: remove 'hotplug-status' once it has served its
+ purpose"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
+
+[ Upstream commit 0f4558ae91870692ce7f509c31c9d6ee721d8cdc ]
+
+This reverts commit 1f2565780e9b7218cf92c7630130e82dcc0fe9c2.
+
+The 'hotplug-status' node should not be removed as long as the vif
+device remains configured. Otherwise the xen-netback would wait for
+re-running the network script even if it was already called (in case of
+the frontent re-connecting). But also, it _should_ be removed when the
+vif device is destroyed (for example when unbinding the driver) -
+otherwise hotplug script would not configure the device whenever it
+re-appear.
+
+Moving removal of the 'hotplug-status' node was a workaround for nothing
+calling network script after xen-netback module is reloaded. But when
+vif interface is re-created (on xen-netback unbind/bind for example),
+the script should be called, regardless of who does that - currently
+this case is not handled by the toolstack, and requires manual
+script call. Keeping hotplug-status=connected to skip the call is wrong
+and leads to not configured interface.
+
+More discussion at
+https://lore.kernel.org/xen-devel/afedd7cb-a291-e773-8b0d-4db9b291fa98@ipxe.org/T/#u
+
+Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
+Reviewed-by: Paul Durrant <paul@xen.org>
+Link: https://lore.kernel.org/r/20220222001817.2264967-1-marmarek@invisiblethingslab.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/xen-netback/xenbus.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
+index 9092b55e087f..df2e1ec9e624 100644
+--- a/drivers/net/xen-netback/xenbus.c
++++ b/drivers/net/xen-netback/xenbus.c
+@@ -499,6 +499,7 @@ static void backend_disconnect(struct backend_info *be)
+               unsigned int queue_index;
+               xen_unregister_watchers(vif);
++              xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status");
+ #ifdef CONFIG_DEBUG_FS
+               xenvif_debugfs_delif(vif);
+ #endif /* CONFIG_DEBUG_FS */
+-- 
+2.34.1
+
diff --git a/queue-4.14/sctp-fix-kernel-infoleak-for-sctp-sockets.patch b/queue-4.14/sctp-fix-kernel-infoleak-for-sctp-sockets.patch
new file mode 100644 (file)
index 0000000..610f828
--- /dev/null
@@ -0,0 +1,128 @@
+From 610cb8483af190d63337d7edd89074cb2a5c0244 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 9 Mar 2022 16:11:45 -0800
+Subject: sctp: fix kernel-infoleak for SCTP sockets
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 633593a808980f82d251d0ca89730d8bb8b0220c ]
+
+syzbot reported a kernel infoleak [1] of 4 bytes.
+
+After analysis, it turned out r->idiag_expires is not initialized
+if inet_sctp_diag_fill() calls inet_diag_msg_common_fill()
+
+Make sure to clear idiag_timer/idiag_retrans/idiag_expires
+and let inet_diag_msg_sctpasoc_fill() fill them again if needed.
+
+[1]
+
+BUG: KMSAN: kernel-infoleak in instrument_copy_to_user include/linux/instrumented.h:121 [inline]
+BUG: KMSAN: kernel-infoleak in copyout lib/iov_iter.c:154 [inline]
+BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x6ef/0x25a0 lib/iov_iter.c:668
+ instrument_copy_to_user include/linux/instrumented.h:121 [inline]
+ copyout lib/iov_iter.c:154 [inline]
+ _copy_to_iter+0x6ef/0x25a0 lib/iov_iter.c:668
+ copy_to_iter include/linux/uio.h:162 [inline]
+ simple_copy_to_iter+0xf3/0x140 net/core/datagram.c:519
+ __skb_datagram_iter+0x2d5/0x11b0 net/core/datagram.c:425
+ skb_copy_datagram_iter+0xdc/0x270 net/core/datagram.c:533
+ skb_copy_datagram_msg include/linux/skbuff.h:3696 [inline]
+ netlink_recvmsg+0x669/0x1c80 net/netlink/af_netlink.c:1977
+ sock_recvmsg_nosec net/socket.c:948 [inline]
+ sock_recvmsg net/socket.c:966 [inline]
+ __sys_recvfrom+0x795/0xa10 net/socket.c:2097
+ __do_sys_recvfrom net/socket.c:2115 [inline]
+ __se_sys_recvfrom net/socket.c:2111 [inline]
+ __x64_sys_recvfrom+0x19d/0x210 net/socket.c:2111
+ do_syscall_x64 arch/x86/entry/common.c:51 [inline]
+ do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+Uninit was created at:
+ slab_post_alloc_hook mm/slab.h:737 [inline]
+ slab_alloc_node mm/slub.c:3247 [inline]
+ __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4975
+ kmalloc_reserve net/core/skbuff.c:354 [inline]
+ __alloc_skb+0x545/0xf90 net/core/skbuff.c:426
+ alloc_skb include/linux/skbuff.h:1158 [inline]
+ netlink_dump+0x3e5/0x16c0 net/netlink/af_netlink.c:2248
+ __netlink_dump_start+0xcf8/0xe90 net/netlink/af_netlink.c:2373
+ netlink_dump_start include/linux/netlink.h:254 [inline]
+ inet_diag_handler_cmd+0x2e7/0x400 net/ipv4/inet_diag.c:1341
+ sock_diag_rcv_msg+0x24a/0x620
+ netlink_rcv_skb+0x40c/0x7e0 net/netlink/af_netlink.c:2494
+ sock_diag_rcv+0x63/0x80 net/core/sock_diag.c:277
+ netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
+ netlink_unicast+0x1093/0x1360 net/netlink/af_netlink.c:1343
+ netlink_sendmsg+0x14d9/0x1720 net/netlink/af_netlink.c:1919
+ sock_sendmsg_nosec net/socket.c:705 [inline]
+ sock_sendmsg net/socket.c:725 [inline]
+ sock_write_iter+0x594/0x690 net/socket.c:1061
+ do_iter_readv_writev+0xa7f/0xc70
+ do_iter_write+0x52c/0x1500 fs/read_write.c:851
+ vfs_writev fs/read_write.c:924 [inline]
+ do_writev+0x645/0xe00 fs/read_write.c:967
+ __do_sys_writev fs/read_write.c:1040 [inline]
+ __se_sys_writev fs/read_write.c:1037 [inline]
+ __x64_sys_writev+0xe5/0x120 fs/read_write.c:1037
+ do_syscall_x64 arch/x86/entry/common.c:51 [inline]
+ do_syscall_64+0x54/0xd0 arch/x86/entry/common.c:82
+ entry_SYSCALL_64_after_hwframe+0x44/0xae
+
+Bytes 68-71 of 2508 are uninitialized
+Memory access of size 2508 starts at ffff888114f9b000
+Data copied to user address 00007f7fe09ff2e0
+
+CPU: 1 PID: 3478 Comm: syz-executor306 Not tainted 5.17.0-rc4-syzkaller #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
+
+Fixes: 8f840e47f190 ("sctp: add the sctp_diag.c file")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Cc: Vlad Yasevich <vyasevich@gmail.com>
+Cc: Neil Horman <nhorman@tuxdriver.com>
+Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
+Reviewed-by: Xin Long <lucien.xin@gmail.com>
+Link: https://lore.kernel.org/r/20220310001145.297371-1-eric.dumazet@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sctp/sctp_diag.c | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
+index 7c7b476bad31..9c9d6cbdd14f 100644
+--- a/net/sctp/sctp_diag.c
++++ b/net/sctp/sctp_diag.c
+@@ -45,10 +45,6 @@ static void inet_diag_msg_sctpasoc_fill(struct inet_diag_msg *r,
+               r->idiag_timer = SCTP_EVENT_TIMEOUT_T3_RTX;
+               r->idiag_retrans = asoc->rtx_data_chunks;
+               r->idiag_expires = jiffies_to_msecs(t3_rtx->expires - jiffies);
+-      } else {
+-              r->idiag_timer = 0;
+-              r->idiag_retrans = 0;
+-              r->idiag_expires = 0;
+       }
+ }
+@@ -128,13 +124,14 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc,
+       r = nlmsg_data(nlh);
+       BUG_ON(!sk_fullsock(sk));
++      r->idiag_timer = 0;
++      r->idiag_retrans = 0;
++      r->idiag_expires = 0;
+       if (asoc) {
+               inet_diag_msg_sctpasoc_fill(r, sk, asoc);
+       } else {
+               inet_diag_msg_common_fill(r, sk);
+               r->idiag_state = sk->sk_state;
+-              r->idiag_timer = 0;
+-              r->idiag_retrans = 0;
+       }
+       if (inet_diag_msg_attrs_fill(sk, skb, r, ext, user_ns, net_admin))
+-- 
+2.34.1
+
diff --git a/queue-4.14/selftests-memfd-clean-up-mapping-in-mfd_fail_write.patch b/queue-4.14/selftests-memfd-clean-up-mapping-in-mfd_fail_write.patch
new file mode 100644 (file)
index 0000000..7ced247
--- /dev/null
@@ -0,0 +1,57 @@
+From d580daedd4127c8d7cba58480334fb697b0ccfea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 25 Feb 2022 19:11:26 -0800
+Subject: selftests/memfd: clean up mapping in mfd_fail_write
+
+From: Mike Kravetz <mike.kravetz@oracle.com>
+
+[ Upstream commit fda153c89af344d21df281009a9d046cf587ea0f ]
+
+Running the memfd script ./run_hugetlbfs_test.sh will often end in error
+as follows:
+
+    memfd-hugetlb: CREATE
+    memfd-hugetlb: BASIC
+    memfd-hugetlb: SEAL-WRITE
+    memfd-hugetlb: SEAL-FUTURE-WRITE
+    memfd-hugetlb: SEAL-SHRINK
+    fallocate(ALLOC) failed: No space left on device
+    ./run_hugetlbfs_test.sh: line 60: 166855 Aborted                 (core dumped) ./memfd_test hugetlbfs
+    opening: ./mnt/memfd
+    fuse: DONE
+
+If no hugetlb pages have been preallocated, run_hugetlbfs_test.sh will
+allocate 'just enough' pages to run the test.  In the SEAL-FUTURE-WRITE
+test the mfd_fail_write routine maps the file, but does not unmap.  As a
+result, two hugetlb pages remain reserved for the mapping.  When the
+fallocate call in the SEAL-SHRINK test attempts allocate all hugetlb
+pages, it is short by the two reserved pages.
+
+Fix by making sure to unmap in mfd_fail_write.
+
+Link: https://lkml.kernel.org/r/20220219004340.56478-1-mike.kravetz@oracle.com
+Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
+Cc: Joel Fernandes <joel@joelfernandes.org>
+Cc: Shuah Khan <shuah@kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/memfd/memfd_test.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
+index 845e5f67b6f0..cf4c5276eb06 100644
+--- a/tools/testing/selftests/memfd/memfd_test.c
++++ b/tools/testing/selftests/memfd/memfd_test.c
+@@ -416,6 +416,7 @@ static void mfd_fail_write(int fd)
+                       printf("mmap()+mprotect() didn't fail as expected\n");
+                       abort();
+               }
++              munmap(p, mfd_def_size);
+       }
+       /* verify PUNCH_HOLE fails */
+-- 
+2.34.1
+
diff --git a/queue-4.14/series b/queue-4.14/series
new file mode 100644 (file)
index 0000000..6f17a85
--- /dev/null
@@ -0,0 +1,15 @@
+net-qlogic-check-the-return-value-of-dma_alloc_coher.patch
+qed-return-status-of-qed_iov_get_link.patch
+ethernet-fix-error-handling-in-xemaclite_of_probe.patch
+net-ethernet-ti-cpts-handle-error-for-clk_enable.patch
+net-ethernet-lpc_eth-handle-error-for-clk_enable.patch
+ax25-fix-null-pointer-dereference-in-ax25_kill_by_de.patch
+net-mlx5-fix-size-field-in-bufferx_reg-struct.patch
+nfc-port100-fix-use-after-free-in-port100_send_compl.patch
+gpio-ts4900-do-not-set-dat-and-oe-together.patch
+sctp-fix-kernel-infoleak-for-sctp-sockets.patch
+net-sysfs-add-check-for-netdevice-being-present-to-s.patch
+revert-xen-netback-remove-hotplug-status-once-it-has.patch
+revert-xen-netback-check-for-hotplug-status-existenc.patch
+tracing-ensure-trace-buffer-is-at-least-4096-bytes-l.patch
+selftests-memfd-clean-up-mapping-in-mfd_fail_write.patch
diff --git a/queue-4.14/tracing-ensure-trace-buffer-is-at-least-4096-bytes-l.patch b/queue-4.14/tracing-ensure-trace-buffer-is-at-least-4096-bytes-l.patch
new file mode 100644 (file)
index 0000000..df009c4
--- /dev/null
@@ -0,0 +1,58 @@
+From 3858db0bb1c3ba3fbc8c074fb80fa9d49996b902 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 14 Feb 2022 14:44:56 +0100
+Subject: tracing: Ensure trace buffer is at least 4096 bytes large
+
+From: Sven Schnelle <svens@linux.ibm.com>
+
+[ Upstream commit 7acf3a127bb7c65ff39099afd78960e77b2ca5de ]
+
+Booting the kernel with 'trace_buf_size=1' give a warning at
+boot during the ftrace selftests:
+
+[    0.892809] Running postponed tracer tests:
+[    0.892893] Testing tracer function:
+[    0.901899] Callback from call_rcu_tasks_trace() invoked.
+[    0.983829] Callback from call_rcu_tasks_rude() invoked.
+[    1.072003] .. bad ring buffer .. corrupted trace buffer ..
+[    1.091944] Callback from call_rcu_tasks() invoked.
+[    1.097695] PASSED
+[    1.097701] Testing dynamic ftrace: .. filter failed count=0 ..FAILED!
+[    1.353474] ------------[ cut here ]------------
+[    1.353478] WARNING: CPU: 0 PID: 1 at kernel/trace/trace.c:1951 run_tracer_selftest+0x13c/0x1b0
+
+Therefore enforce a minimum of 4096 bytes to make the selftest pass.
+
+Link: https://lkml.kernel.org/r/20220214134456.1751749-1-svens@linux.ibm.com
+
+Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/trace/trace.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
+index c1da2a4a629a..c728acb6b14c 100644
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1118,10 +1118,12 @@ static int __init set_buf_size(char *str)
+       if (!str)
+               return 0;
+       buf_size = memparse(str, &str);
+-      /* nr_entries can not be zero */
+-      if (buf_size == 0)
+-              return 0;
+-      trace_buf_size = buf_size;
++      /*
++       * nr_entries can not be zero and the startup
++       * tests require some buffer space. Therefore
++       * ensure we have at least 4096 bytes of buffer.
++       */
++      trace_buf_size = max(4096UL, buf_size);
+       return 1;
+ }
+ __setup("trace_buf_size=", set_buf_size);
+-- 
+2.34.1
+