]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Oct 2021 11:15:44 +0000 (13:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Oct 2021 11:15:44 +0000 (13:15 +0200)
added patches:
ethernet-s2io-fix-setting-mac-address-during-resume.patch
gpio-74x164-add-spi-device-id-table.patch
gpio-pca953x-improve-bias-setting.patch
net-arc-select-crc32.patch
net-dsa-fix-spurious-error-message-when-unoffloaded-port-leaves-bridge.patch
net-dsa-microchip-added-the-condition-for-scheduling-ksz_mib_read_work.patch
net-dsa-mv88e6xxx-don-t-use-phy_detect-on-internal-phy-s.patch
net-encx24j600-check-error-in-devm_regmap_init_encx24j600.patch
net-korina-select-crc32.patch
net-mlx5e-fix-memory-leak-in-mlx5_core_destroy_cq-error-path.patch
net-mlx5e-mutually-exclude-rx-fcs-and-rx-port-timestamp.patch
net-mlx5e-switchdev-representors-are-not-vlan-challenged.patch
net-phy-do-not-shutdown-phys-in-ready-state.patch
net-smc-improved-fix-wait-on-already-cleared-link.patch
net-stmmac-fix-get_hw_feature-on-old-hardware.patch
nvme-pci-fix-abort-command-id.patch
sctp-account-stream-padding-length-for-reconf-chunk.patch

18 files changed:
queue-5.14/ethernet-s2io-fix-setting-mac-address-during-resume.patch [new file with mode: 0644]
queue-5.14/gpio-74x164-add-spi-device-id-table.patch [new file with mode: 0644]
queue-5.14/gpio-pca953x-improve-bias-setting.patch [new file with mode: 0644]
queue-5.14/net-arc-select-crc32.patch [new file with mode: 0644]
queue-5.14/net-dsa-fix-spurious-error-message-when-unoffloaded-port-leaves-bridge.patch [new file with mode: 0644]
queue-5.14/net-dsa-microchip-added-the-condition-for-scheduling-ksz_mib_read_work.patch [new file with mode: 0644]
queue-5.14/net-dsa-mv88e6xxx-don-t-use-phy_detect-on-internal-phy-s.patch [new file with mode: 0644]
queue-5.14/net-encx24j600-check-error-in-devm_regmap_init_encx24j600.patch [new file with mode: 0644]
queue-5.14/net-korina-select-crc32.patch [new file with mode: 0644]
queue-5.14/net-mlx5e-fix-memory-leak-in-mlx5_core_destroy_cq-error-path.patch [new file with mode: 0644]
queue-5.14/net-mlx5e-mutually-exclude-rx-fcs-and-rx-port-timestamp.patch [new file with mode: 0644]
queue-5.14/net-mlx5e-switchdev-representors-are-not-vlan-challenged.patch [new file with mode: 0644]
queue-5.14/net-phy-do-not-shutdown-phys-in-ready-state.patch [new file with mode: 0644]
queue-5.14/net-smc-improved-fix-wait-on-already-cleared-link.patch [new file with mode: 0644]
queue-5.14/net-stmmac-fix-get_hw_feature-on-old-hardware.patch [new file with mode: 0644]
queue-5.14/nvme-pci-fix-abort-command-id.patch [new file with mode: 0644]
queue-5.14/sctp-account-stream-padding-length-for-reconf-chunk.patch [new file with mode: 0644]
queue-5.14/series

diff --git a/queue-5.14/ethernet-s2io-fix-setting-mac-address-during-resume.patch b/queue-5.14/ethernet-s2io-fix-setting-mac-address-during-resume.patch
new file mode 100644 (file)
index 0000000..31d581c
--- /dev/null
@@ -0,0 +1,51 @@
+From 40507e7aada8422c38aafa0c8a1a09e4623c712a Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 13 Oct 2021 16:35:49 +0200
+Subject: ethernet: s2io: fix setting mac address during resume
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 40507e7aada8422c38aafa0c8a1a09e4623c712a upstream.
+
+After recent cleanups, gcc started warning about a suspicious
+memcpy() call during the s2io_io_resume() function:
+
+In function '__dev_addr_set',
+    inlined from 'eth_hw_addr_set' at include/linux/etherdevice.h:318:2,
+    inlined from 's2io_set_mac_addr' at drivers/net/ethernet/neterion/s2io.c:5205:2,
+    inlined from 's2io_io_resume' at drivers/net/ethernet/neterion/s2io.c:8569:7:
+arch/x86/include/asm/string_32.h:182:25: error: '__builtin_memcpy' accessing 6 bytes at offsets 0 and 2 overlaps 4 bytes at offset 2 [-Werror=restrict]
+  182 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
+      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
+include/linux/netdevice.h:4648:9: note: in expansion of macro 'memcpy'
+ 4648 |         memcpy(dev->dev_addr, addr, len);
+      |         ^~~~~~
+
+What apparently happened is that an old cleanup changed the calling
+conventions for s2io_set_mac_addr() from taking an ethernet address
+as a character array to taking a struct sockaddr, but one of the
+callers was not changed at the same time.
+
+Change it to instead call the low-level do_s2io_prog_unicast() function
+that still takes the old argument type.
+
+Fixes: 2fd376884558 ("S2io: Added support set_mac_address driver entry point")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20211013143613.2049096-1-arnd@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/neterion/s2io.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/neterion/s2io.c
++++ b/drivers/net/ethernet/neterion/s2io.c
+@@ -8566,7 +8566,7 @@ static void s2io_io_resume(struct pci_de
+                       return;
+               }
+-              if (s2io_set_mac_addr(netdev, netdev->dev_addr) == FAILURE) {
++              if (do_s2io_prog_unicast(netdev, netdev->dev_addr) == FAILURE) {
+                       s2io_card_down(sp);
+                       pr_err("Can't restore mac addr after reset.\n");
+                       return;
diff --git a/queue-5.14/gpio-74x164-add-spi-device-id-table.patch b/queue-5.14/gpio-74x164-add-spi-device-id-table.patch
new file mode 100644 (file)
index 0000000..7a0b1a5
--- /dev/null
@@ -0,0 +1,47 @@
+From be4491838359e78e42e88db4ac479e21c5eda1e0 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@kernel.org>
+Date: Wed, 22 Sep 2021 17:17:36 +0100
+Subject: gpio: 74x164: Add SPI device ID table
+
+From: Mark Brown <broonie@kernel.org>
+
+commit be4491838359e78e42e88db4ac479e21c5eda1e0 upstream.
+
+Currently autoloading for SPI devices does not use the DT ID table, it uses
+SPI modalises. Supporting OF modalises is going to be difficult if not
+impractical, an attempt was made but has been reverted, so ensure that
+module autoloading works for this driver by adding a SPI device ID table.
+
+Fixes: 96c8395e2166 ("spi: Revert modalias changes")
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpio-74x164.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/gpio/gpio-74x164.c
++++ b/drivers/gpio/gpio-74x164.c
+@@ -174,6 +174,13 @@ static int gen_74x164_remove(struct spi_
+       return 0;
+ }
++static const struct spi_device_id gen_74x164_spi_ids[] = {
++      { .name = "74hc595" },
++      { .name = "74lvc594" },
++      {},
++};
++MODULE_DEVICE_TABLE(spi, gen_74x164_spi_ids);
++
+ static const struct of_device_id gen_74x164_dt_ids[] = {
+       { .compatible = "fairchild,74hc595" },
+       { .compatible = "nxp,74lvc594" },
+@@ -188,6 +195,7 @@ static struct spi_driver gen_74x164_driv
+       },
+       .probe          = gen_74x164_probe,
+       .remove         = gen_74x164_remove,
++      .id_table       = gen_74x164_spi_ids,
+ };
+ module_spi_driver(gen_74x164_driver);
diff --git a/queue-5.14/gpio-pca953x-improve-bias-setting.patch b/queue-5.14/gpio-pca953x-improve-bias-setting.patch
new file mode 100644 (file)
index 0000000..6bda859
--- /dev/null
@@ -0,0 +1,70 @@
+From 55a9968c7e139209a9e93d4ca4321731bea5fc95 Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Fri, 24 Sep 2021 01:46:40 +0300
+Subject: gpio: pca953x: Improve bias setting
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+commit 55a9968c7e139209a9e93d4ca4321731bea5fc95 upstream.
+
+The commit 15add06841a3 ("gpio: pca953x: add ->set_config implementation")
+introduced support for bias setting. However this, due to being half-baked,
+brought potential issues:
+ - the turning bias via disabling makes the pin floating for a while;
+ - once enabled, bias can't be disabled.
+
+Fix all these by adding support for bias disabling and move the disabling
+part under the corresponding conditional.
+
+While at it, add support for default setting, since it's cheap to add.
+
+Fixes: 15add06841a3 ("gpio: pca953x: add ->set_config implementation")
+Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpio-pca953x.c |   16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -559,21 +559,21 @@ static int pca953x_gpio_set_pull_up_down
+       mutex_lock(&chip->i2c_lock);
+-      /* Disable pull-up/pull-down */
+-      ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0);
+-      if (ret)
+-              goto exit;
+-
+       /* Configure pull-up/pull-down */
+       if (config == PIN_CONFIG_BIAS_PULL_UP)
+               ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, bit);
+       else if (config == PIN_CONFIG_BIAS_PULL_DOWN)
+               ret = regmap_write_bits(chip->regmap, pull_sel_reg, bit, 0);
++      else
++              ret = 0;
+       if (ret)
+               goto exit;
+-      /* Enable pull-up/pull-down */
+-      ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit);
++      /* Disable/Enable pull-up/pull-down */
++      if (config == PIN_CONFIG_BIAS_DISABLE)
++              ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, 0);
++      else
++              ret = regmap_write_bits(chip->regmap, pull_en_reg, bit, bit);
+ exit:
+       mutex_unlock(&chip->i2c_lock);
+@@ -587,7 +587,9 @@ static int pca953x_gpio_set_config(struc
+       switch (pinconf_to_config_param(config)) {
+       case PIN_CONFIG_BIAS_PULL_UP:
++      case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT:
+       case PIN_CONFIG_BIAS_PULL_DOWN:
++      case PIN_CONFIG_BIAS_DISABLE:
+               return pca953x_gpio_set_pull_up_down(chip, offset, config);
+       default:
+               return -ENOTSUPP;
diff --git a/queue-5.14/net-arc-select-crc32.patch b/queue-5.14/net-arc-select-crc32.patch
new file mode 100644 (file)
index 0000000..ccac205
--- /dev/null
@@ -0,0 +1,43 @@
+From e599ee234ad4fdfe241d937bbabd96e0d8f9d868 Mon Sep 17 00:00:00 2001
+From: Vegard Nossum <vegard.nossum@oracle.com>
+Date: Tue, 12 Oct 2021 11:34:46 +0200
+Subject: net: arc: select CRC32
+
+From: Vegard Nossum <vegard.nossum@oracle.com>
+
+commit e599ee234ad4fdfe241d937bbabd96e0d8f9d868 upstream.
+
+Fix the following build/link error by adding a dependency on the CRC32
+routines:
+
+  ld: drivers/net/ethernet/arc/emac_main.o: in function `arc_emac_set_rx_mode':
+  emac_main.c:(.text+0xb11): undefined reference to `crc32_le'
+
+The crc32_le() call comes through the ether_crc_le() call in
+arc_emac_set_rx_mode().
+
+[v2: moved the select to ARC_EMAC_CORE; the Makefile is a bit confusing,
+but the error comes from emac_main.o, which is part of the arc_emac module,
+which in turn is enabled by CONFIG_ARC_EMAC_CORE. Note that arc_emac is
+different from emac_arc...]
+
+Fixes: 775dd682e2b0ec ("arc_emac: implement promiscuous mode and multicast filtering")
+Cc: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
+Link: https://lore.kernel.org/r/20211012093446.1575-1-vegard.nossum@oracle.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/arc/Kconfig |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/ethernet/arc/Kconfig
++++ b/drivers/net/ethernet/arc/Kconfig
+@@ -21,6 +21,7 @@ config ARC_EMAC_CORE
+       depends on ARC || ARCH_ROCKCHIP || COMPILE_TEST
+       select MII
+       select PHYLIB
++      select CRC32
+ config ARC_EMAC
+       tristate "ARC EMAC support"
diff --git a/queue-5.14/net-dsa-fix-spurious-error-message-when-unoffloaded-port-leaves-bridge.patch b/queue-5.14/net-dsa-fix-spurious-error-message-when-unoffloaded-port-leaves-bridge.patch
new file mode 100644 (file)
index 0000000..816aecc
--- /dev/null
@@ -0,0 +1,42 @@
+From 43a4b4dbd48c9006ef64df3a12acf33bdfe11c61 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= <alsi@bang-olufsen.dk>
+Date: Tue, 12 Oct 2021 13:27:31 +0200
+Subject: net: dsa: fix spurious error message when unoffloaded port leaves bridge
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alvin Šipraga <alsi@bang-olufsen.dk>
+
+commit 43a4b4dbd48c9006ef64df3a12acf33bdfe11c61 upstream.
+
+Flip the sign of a return value check, thereby suppressing the following
+spurious error:
+
+  port 2 failed to notify DSA_NOTIFIER_BRIDGE_LEAVE: -EOPNOTSUPP
+
+... which is emitted when removing an unoffloaded DSA switch port from a
+bridge.
+
+Fixes: d371b7c92d19 ("net: dsa: Unset vlan_filtering when ports leave the bridge")
+Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Link: https://lore.kernel.org/r/20211012112730.3429157-1-alvin@pqrs.dk
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/dsa/switch.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/dsa/switch.c
++++ b/net/dsa/switch.c
+@@ -148,7 +148,7 @@ static int dsa_switch_bridge_leave(struc
+               if (extack._msg)
+                       dev_err(ds->dev, "port %d: %s\n", info->port,
+                               extack._msg);
+-              if (err && err != EOPNOTSUPP)
++              if (err && err != -EOPNOTSUPP)
+                       return err;
+       }
+       return 0;
diff --git a/queue-5.14/net-dsa-microchip-added-the-condition-for-scheduling-ksz_mib_read_work.patch b/queue-5.14/net-dsa-microchip-added-the-condition-for-scheduling-ksz_mib_read_work.patch
new file mode 100644 (file)
index 0000000..4411c7e
--- /dev/null
@@ -0,0 +1,48 @@
+From ef1100ef20f29aec4e62abeccdb5bdbebba1e378 Mon Sep 17 00:00:00 2001
+From: Arun Ramadoss <arun.ramadoss@microchip.com>
+Date: Mon, 11 Oct 2021 21:18:08 +0530
+Subject: net: dsa: microchip: Added the condition for scheduling ksz_mib_read_work
+
+From: Arun Ramadoss <arun.ramadoss@microchip.com>
+
+commit ef1100ef20f29aec4e62abeccdb5bdbebba1e378 upstream.
+
+When the ksz module is installed and removed using rmmod, kernel crashes
+with null pointer dereferrence error. During rmmod, ksz_switch_remove
+function tries to cancel the mib_read_workqueue using
+cancel_delayed_work_sync routine and unregister switch from dsa.
+
+During dsa_unregister_switch it calls ksz_mac_link_down, which in turn
+reschedules the workqueue since mib_interval is non-zero.
+Due to which queue executed after mib_interval and it tries to access
+dp->slave. But the slave is unregistered in the ksz_switch_remove
+function. Hence kernel crashes.
+
+To avoid this crash, before canceling the workqueue, resetted the
+mib_interval to 0.
+
+v1 -> v2:
+-Removed the if condition in ksz_mib_read_work
+
+Fixes: 469b390e1ba3 ("net: dsa: microchip: use delayed_work instead of timer + work")
+Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/dsa/microchip/ksz_common.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/microchip/ksz_common.c
++++ b/drivers/net/dsa/microchip/ksz_common.c
+@@ -449,8 +449,10 @@ EXPORT_SYMBOL(ksz_switch_register);
+ void ksz_switch_remove(struct ksz_device *dev)
+ {
+       /* timer started */
+-      if (dev->mib_read_interval)
++      if (dev->mib_read_interval) {
++              dev->mib_read_interval = 0;
+               cancel_delayed_work_sync(&dev->mib_read);
++      }
+       dev->dev_ops->exit(dev);
+       dsa_unregister_switch(dev->ds);
diff --git a/queue-5.14/net-dsa-mv88e6xxx-don-t-use-phy_detect-on-internal-phy-s.patch b/queue-5.14/net-dsa-mv88e6xxx-don-t-use-phy_detect-on-internal-phy-s.patch
new file mode 100644 (file)
index 0000000..c8b88bc
--- /dev/null
@@ -0,0 +1,58 @@
+From 4a3e0aeddf091f00974b02627c157843ce382a24 Mon Sep 17 00:00:00 2001
+From: Maarten Zanders <maarten.zanders@mind.be>
+Date: Mon, 11 Oct 2021 16:27:20 +0200
+Subject: net: dsa: mv88e6xxx: don't use PHY_DETECT on internal PHY's
+
+From: Maarten Zanders <maarten.zanders@mind.be>
+
+commit 4a3e0aeddf091f00974b02627c157843ce382a24 upstream.
+
+mv88e6xxx_port_ppu_updates() interpretes data in the PORT_STS
+register incorrectly for internal ports (ie no PPU). In these
+cases, the PHY_DETECT bit indicates link status. This results
+in forcing the MAC state whenever the PHY link goes down which
+is not intended. As a side effect, LED's configured to show
+link status stay lit even though the physical link is down.
+
+Add a check in mac_link_down and mac_link_up to see if it
+concerns an external port and only then, look at PPU status.
+
+Fixes: 5d5b231da7ac (net: dsa: mv88e6xxx: use PHY_DETECT in mac_link_up/mac_link_down)
+Reported-by: Maarten Zanders <m.zanders@televic.com>
+Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
+Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/dsa/mv88e6xxx/chip.c |   13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/dsa/mv88e6xxx/chip.c
++++ b/drivers/net/dsa/mv88e6xxx/chip.c
+@@ -749,7 +749,11 @@ static void mv88e6xxx_mac_link_down(stru
+       ops = chip->info->ops;
+       mv88e6xxx_reg_lock(chip);
+-      if ((!mv88e6xxx_port_ppu_updates(chip, port) ||
++      /* Internal PHYs propagate their configuration directly to the MAC.
++       * External PHYs depend on whether the PPU is enabled for this port.
++       */
++      if (((!mv88e6xxx_phy_is_internal(ds, port) &&
++            !mv88e6xxx_port_ppu_updates(chip, port)) ||
+            mode == MLO_AN_FIXED) && ops->port_sync_link)
+               err = ops->port_sync_link(chip, port, mode, false);
+       mv88e6xxx_reg_unlock(chip);
+@@ -772,7 +776,12 @@ static void mv88e6xxx_mac_link_up(struct
+       ops = chip->info->ops;
+       mv88e6xxx_reg_lock(chip);
+-      if (!mv88e6xxx_port_ppu_updates(chip, port) || mode == MLO_AN_FIXED) {
++      /* Internal PHYs propagate their configuration directly to the MAC.
++       * External PHYs depend on whether the PPU is enabled for this port.
++       */
++      if ((!mv88e6xxx_phy_is_internal(ds, port) &&
++           !mv88e6xxx_port_ppu_updates(chip, port)) ||
++          mode == MLO_AN_FIXED) {
+               /* FIXME: for an automedia port, should we force the link
+                * down here - what if the link comes up due to "other" media
+                * while we're bringing the port up, how is the exclusivity
diff --git a/queue-5.14/net-encx24j600-check-error-in-devm_regmap_init_encx24j600.patch b/queue-5.14/net-encx24j600-check-error-in-devm_regmap_init_encx24j600.patch
new file mode 100644 (file)
index 0000000..453605d
--- /dev/null
@@ -0,0 +1,123 @@
+From f03dca0c9e2297c84a018e306f8a9cd534ee4287 Mon Sep 17 00:00:00 2001
+From: Nanyong Sun <sunnanyong@huawei.com>
+Date: Tue, 12 Oct 2021 20:59:01 +0800
+Subject: net: encx24j600: check error in devm_regmap_init_encx24j600
+
+From: Nanyong Sun <sunnanyong@huawei.com>
+
+commit f03dca0c9e2297c84a018e306f8a9cd534ee4287 upstream.
+
+devm_regmap_init may return error which caused by like out of memory,
+this will results in null pointer dereference later when reading
+or writing register:
+
+general protection fault in encx24j600_spi_probe
+KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
+CPU: 0 PID: 286 Comm: spi-encx24j600- Not tainted 5.15.0-rc2-00142-g9978db750e31-dirty #11 9c53a778c1306b1b02359f3c2bbedc0222cba652
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
+RIP: 0010:regcache_cache_bypass drivers/base/regmap/regcache.c:540
+Code: 54 41 89 f4 55 53 48 89 fb 48 83 ec 08 e8 26 94 a8 fe 48 8d bb a0 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 4a 03 00 00 4c 8d ab b0 00 00 00 48 8b ab a0 00
+RSP: 0018:ffffc900010476b8 EFLAGS: 00010207
+RAX: dffffc0000000000 RBX: fffffffffffffff4 RCX: 0000000000000000
+RDX: 0000000000000012 RSI: ffff888002de0000 RDI: 0000000000000094
+RBP: ffff888013c9a000 R08: 0000000000000000 R09: fffffbfff3f9cc6a
+R10: ffffc900010476e8 R11: fffffbfff3f9cc69 R12: 0000000000000001
+R13: 000000000000000a R14: ffff888013c9af54 R15: ffff888013c9ad08
+FS:  00007ffa984ab580(0000) GS:ffff88801fe00000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 000055a6384136c8 CR3: 000000003bbe6003 CR4: 0000000000770ef0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+PKRU: 55555554
+Call Trace:
+ encx24j600_spi_probe drivers/net/ethernet/microchip/encx24j600.c:459
+ spi_probe drivers/spi/spi.c:397
+ really_probe drivers/base/dd.c:517
+ __driver_probe_device drivers/base/dd.c:751
+ driver_probe_device drivers/base/dd.c:782
+ __device_attach_driver drivers/base/dd.c:899
+ bus_for_each_drv drivers/base/bus.c:427
+ __device_attach drivers/base/dd.c:971
+ bus_probe_device drivers/base/bus.c:487
+ device_add drivers/base/core.c:3364
+ __spi_add_device drivers/spi/spi.c:599
+ spi_add_device drivers/spi/spi.c:641
+ spi_new_device drivers/spi/spi.c:717
+ new_device_store+0x18c/0x1f1 [spi_stub 4e02719357f1ff33f5a43d00630982840568e85e]
+ dev_attr_store drivers/base/core.c:2074
+ sysfs_kf_write fs/sysfs/file.c:139
+ kernfs_fop_write_iter fs/kernfs/file.c:300
+ new_sync_write fs/read_write.c:508 (discriminator 4)
+ vfs_write fs/read_write.c:594
+ ksys_write fs/read_write.c:648
+ do_syscall_64 arch/x86/entry/common.c:50
+ entry_SYSCALL_64_after_hwframe arch/x86/entry/entry_64.S:113
+
+Add error check in devm_regmap_init_encx24j600 to avoid this situation.
+
+Fixes: 04fbfce7a222 ("net: Microchip encx24j600 driver")
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Nanyong Sun <sunnanyong@huawei.com>
+Link: https://lore.kernel.org/r/20211012125901.3623144-1-sunnanyong@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/microchip/encx24j600-regmap.c |   10 ++++++++--
+ drivers/net/ethernet/microchip/encx24j600.c        |    5 ++++-
+ drivers/net/ethernet/microchip/encx24j600_hw.h     |    4 ++--
+ 3 files changed, 14 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/ethernet/microchip/encx24j600-regmap.c
++++ b/drivers/net/ethernet/microchip/encx24j600-regmap.c
+@@ -497,13 +497,19 @@ static struct regmap_bus phymap_encx24j6
+       .reg_read = regmap_encx24j600_phy_reg_read,
+ };
+-void devm_regmap_init_encx24j600(struct device *dev,
+-                               struct encx24j600_context *ctx)
++int devm_regmap_init_encx24j600(struct device *dev,
++                              struct encx24j600_context *ctx)
+ {
+       mutex_init(&ctx->mutex);
+       regcfg.lock_arg = ctx;
+       ctx->regmap = devm_regmap_init(dev, &regmap_encx24j600, ctx, &regcfg);
++      if (IS_ERR(ctx->regmap))
++              return PTR_ERR(ctx->regmap);
+       ctx->phymap = devm_regmap_init(dev, &phymap_encx24j600, ctx, &phycfg);
++      if (IS_ERR(ctx->phymap))
++              return PTR_ERR(ctx->phymap);
++
++      return 0;
+ }
+ EXPORT_SYMBOL_GPL(devm_regmap_init_encx24j600);
+--- a/drivers/net/ethernet/microchip/encx24j600.c
++++ b/drivers/net/ethernet/microchip/encx24j600.c
+@@ -1023,10 +1023,13 @@ static int encx24j600_spi_probe(struct s
+       priv->speed = SPEED_100;
+       priv->ctx.spi = spi;
+-      devm_regmap_init_encx24j600(&spi->dev, &priv->ctx);
+       ndev->irq = spi->irq;
+       ndev->netdev_ops = &encx24j600_netdev_ops;
++      ret = devm_regmap_init_encx24j600(&spi->dev, &priv->ctx);
++      if (ret)
++              goto out_free;
++
+       mutex_init(&priv->lock);
+       /* Reset device and check if it is connected */
+--- a/drivers/net/ethernet/microchip/encx24j600_hw.h
++++ b/drivers/net/ethernet/microchip/encx24j600_hw.h
+@@ -15,8 +15,8 @@ struct encx24j600_context {
+       int bank;
+ };
+-void devm_regmap_init_encx24j600(struct device *dev,
+-                               struct encx24j600_context *ctx);
++int devm_regmap_init_encx24j600(struct device *dev,
++                              struct encx24j600_context *ctx);
+ /* Single-byte instructions */
+ #define BANK_SELECT(bank) (0xC0 | ((bank & (BANK_MASK >> BANK_SHIFT)) << 1))
diff --git a/queue-5.14/net-korina-select-crc32.patch b/queue-5.14/net-korina-select-crc32.patch
new file mode 100644 (file)
index 0000000..3b3b509
--- /dev/null
@@ -0,0 +1,36 @@
+From 427f974d9727ca681085ddcd0530c97ab5811ae0 Mon Sep 17 00:00:00 2001
+From: Vegard Nossum <vegard.nossum@oracle.com>
+Date: Tue, 12 Oct 2021 17:25:09 +0200
+Subject: net: korina: select CRC32
+
+From: Vegard Nossum <vegard.nossum@oracle.com>
+
+commit 427f974d9727ca681085ddcd0530c97ab5811ae0 upstream.
+
+Fix the following build/link error by adding a dependency on the CRC32
+routines:
+
+  ld: drivers/net/ethernet/korina.o: in function `korina_multicast_list':
+  korina.c:(.text+0x1af): undefined reference to `crc32_le'
+
+Fixes: ef11291bcd5f9 ("Add support the Korina (IDT RC32434) Ethernet MAC")
+Cc: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
+Acked-by: Florian fainelli <f.fainelli@gmail.com>
+Link: https://lore.kernel.org/r/20211012152509.21771-1-vegard.nossum@oracle.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/Kconfig |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/ethernet/Kconfig
++++ b/drivers/net/ethernet/Kconfig
+@@ -100,6 +100,7 @@ config JME
+ config KORINA
+       tristate "Korina (IDT RC32434) Ethernet support"
+       depends on MIKROTIK_RB532 || COMPILE_TEST
++      select CRC32
+       select MII
+       help
+         If you have a Mikrotik RouterBoard 500 or IDT RC32434
diff --git a/queue-5.14/net-mlx5e-fix-memory-leak-in-mlx5_core_destroy_cq-error-path.patch b/queue-5.14/net-mlx5e-fix-memory-leak-in-mlx5_core_destroy_cq-error-path.patch
new file mode 100644 (file)
index 0000000..18c31ae
--- /dev/null
@@ -0,0 +1,81 @@
+From 94b960b9deffc02fc0747afc01f72cc62ab099e3 Mon Sep 17 00:00:00 2001
+From: Valentine Fatiev <valentinef@nvidia.com>
+Date: Sun, 15 Aug 2021 17:43:19 +0300
+Subject: net/mlx5e: Fix memory leak in mlx5_core_destroy_cq() error path
+
+From: Valentine Fatiev <valentinef@nvidia.com>
+
+commit 94b960b9deffc02fc0747afc01f72cc62ab099e3 upstream.
+
+Prior to this patch in case mlx5_core_destroy_cq() failed it returns
+without completing all destroy operations and that leads to memory leak.
+Instead, complete the destroy flow before return error.
+
+Also move mlx5_debug_cq_remove() to the beginning of mlx5_core_destroy_cq()
+to be symmetrical with mlx5_core_create_cq().
+
+kmemleak complains on:
+
+unreferenced object 0xc000000038625100 (size 64):
+  comm "ethtool", pid 28301, jiffies 4298062946 (age 785.380s)
+  hex dump (first 32 bytes):
+    60 01 48 94 00 00 00 c0 b8 05 34 c3 00 00 00 c0  `.H.......4.....
+    02 00 00 00 00 00 00 00 00 db 7d c1 00 00 00 c0  ..........}.....
+  backtrace:
+    [<000000009e8643cb>] add_res_tree+0xd0/0x270 [mlx5_core]
+    [<00000000e7cb8e6c>] mlx5_debug_cq_add+0x5c/0xc0 [mlx5_core]
+    [<000000002a12918f>] mlx5_core_create_cq+0x1d0/0x2d0 [mlx5_core]
+    [<00000000cef0a696>] mlx5e_create_cq+0x210/0x3f0 [mlx5_core]
+    [<000000009c642c26>] mlx5e_open_cq+0xb4/0x130 [mlx5_core]
+    [<0000000058dfa578>] mlx5e_ptp_open+0x7f4/0xe10 [mlx5_core]
+    [<0000000081839561>] mlx5e_open_channels+0x9cc/0x13e0 [mlx5_core]
+    [<0000000009cf05d4>] mlx5e_switch_priv_channels+0xa4/0x230
+[mlx5_core]
+    [<0000000042bbedd8>] mlx5e_safe_switch_params+0x14c/0x300
+[mlx5_core]
+    [<0000000004bc9db8>] set_pflag_tx_port_ts+0x9c/0x160 [mlx5_core]
+    [<00000000a0553443>] mlx5e_set_priv_flags+0xd0/0x1b0 [mlx5_core]
+    [<00000000a8f3d84b>] ethnl_set_privflags+0x234/0x2d0
+    [<00000000fd27f27c>] genl_family_rcv_msg_doit+0x108/0x1d0
+    [<00000000f495e2bb>] genl_family_rcv_msg+0xe4/0x1f0
+    [<00000000646c5c2c>] genl_rcv_msg+0x78/0x120
+    [<00000000d53e384e>] netlink_rcv_skb+0x74/0x1a0
+
+Fixes: e126ba97dba9 ("mlx5: Add driver for Mellanox Connect-IB adapters")
+Signed-off-by: Valentine Fatiev <valentinef@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/cq.c |    7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cq.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
+@@ -154,6 +154,8 @@ int mlx5_core_destroy_cq(struct mlx5_cor
+       u32 in[MLX5_ST_SZ_DW(destroy_cq_in)] = {};
+       int err;
++      mlx5_debug_cq_remove(dev, cq);
++
+       mlx5_eq_del_cq(mlx5_get_async_eq(dev), cq);
+       mlx5_eq_del_cq(&cq->eq->core, cq);
+@@ -161,16 +163,13 @@ int mlx5_core_destroy_cq(struct mlx5_cor
+       MLX5_SET(destroy_cq_in, in, cqn, cq->cqn);
+       MLX5_SET(destroy_cq_in, in, uid, cq->uid);
+       err = mlx5_cmd_exec_in(dev, destroy_cq, in);
+-      if (err)
+-              return err;
+       synchronize_irq(cq->irqn);
+-      mlx5_debug_cq_remove(dev, cq);
+       mlx5_cq_put(cq);
+       wait_for_completion(&cq->free);
+-      return 0;
++      return err;
+ }
+ EXPORT_SYMBOL(mlx5_core_destroy_cq);
diff --git a/queue-5.14/net-mlx5e-mutually-exclude-rx-fcs-and-rx-port-timestamp.patch b/queue-5.14/net-mlx5e-mutually-exclude-rx-fcs-and-rx-port-timestamp.patch
new file mode 100644 (file)
index 0000000..d215374
--- /dev/null
@@ -0,0 +1,129 @@
+From 0bc73ad46a76ed6ece4dcacb28858e7b38561e1c Mon Sep 17 00:00:00 2001
+From: Aya Levin <ayal@nvidia.com>
+Date: Sun, 26 Sep 2021 17:55:41 +0300
+Subject: net/mlx5e: Mutually exclude RX-FCS and RX-port-timestamp
+
+From: Aya Levin <ayal@nvidia.com>
+
+commit 0bc73ad46a76ed6ece4dcacb28858e7b38561e1c upstream.
+
+Due to current HW arch limitations, RX-FCS (scattering FCS frame field
+to software) and RX-port-timestamp (improved timestamp accuracy on the
+receive side) can't work together.
+RX-port-timestamp is not controlled by the user and it is enabled by
+default when supported by the HW/FW.
+This patch sets RX-port-timestamp opposite to RX-FCS configuration.
+
+Fixes: 102722fc6832 ("net/mlx5e: Add support for RXFCS feature flag")
+Signed-off-by: Aya Levin <ayal@nvidia.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_main.c |   57 ++++++++++++++++++++--
+ include/linux/mlx5/mlx5_ifc.h                     |   10 +++
+ 2 files changed, 60 insertions(+), 7 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+@@ -3724,20 +3724,67 @@ static int set_feature_rx_all(struct net
+       return mlx5_set_port_fcs(mdev, !enable);
+ }
++static int mlx5e_set_rx_port_ts(struct mlx5_core_dev *mdev, bool enable)
++{
++      u32 in[MLX5_ST_SZ_DW(pcmr_reg)] = {};
++      bool supported, curr_state;
++      int err;
++
++      if (!MLX5_CAP_GEN(mdev, ports_check))
++              return 0;
++
++      err = mlx5_query_ports_check(mdev, in, sizeof(in));
++      if (err)
++              return err;
++
++      supported = MLX5_GET(pcmr_reg, in, rx_ts_over_crc_cap);
++      curr_state = MLX5_GET(pcmr_reg, in, rx_ts_over_crc);
++
++      if (!supported || enable == curr_state)
++              return 0;
++
++      MLX5_SET(pcmr_reg, in, local_port, 1);
++      MLX5_SET(pcmr_reg, in, rx_ts_over_crc, enable);
++
++      return mlx5_set_ports_check(mdev, in, sizeof(in));
++}
++
+ static int set_feature_rx_fcs(struct net_device *netdev, bool enable)
+ {
+       struct mlx5e_priv *priv = netdev_priv(netdev);
++      struct mlx5e_channels *chs = &priv->channels;
++      struct mlx5_core_dev *mdev = priv->mdev;
+       int err;
+       mutex_lock(&priv->state_lock);
+-      priv->channels.params.scatter_fcs_en = enable;
+-      err = mlx5e_modify_channels_scatter_fcs(&priv->channels, enable);
+-      if (err)
+-              priv->channels.params.scatter_fcs_en = !enable;
++      if (enable) {
++              err = mlx5e_set_rx_port_ts(mdev, false);
++              if (err)
++                      goto out;
++
++              chs->params.scatter_fcs_en = true;
++              err = mlx5e_modify_channels_scatter_fcs(chs, true);
++              if (err) {
++                      chs->params.scatter_fcs_en = false;
++                      mlx5e_set_rx_port_ts(mdev, true);
++              }
++      } else {
++              chs->params.scatter_fcs_en = false;
++              err = mlx5e_modify_channels_scatter_fcs(chs, false);
++              if (err) {
++                      chs->params.scatter_fcs_en = true;
++                      goto out;
++              }
++              err = mlx5e_set_rx_port_ts(mdev, true);
++              if (err) {
++                      mlx5_core_warn(mdev, "Failed to set RX port timestamp %d\n", err);
++                      err = 0;
++              }
++      }
++out:
+       mutex_unlock(&priv->state_lock);
+-
+       return err;
+ }
+--- a/include/linux/mlx5/mlx5_ifc.h
++++ b/include/linux/mlx5/mlx5_ifc.h
+@@ -9467,16 +9467,22 @@ struct mlx5_ifc_pcmr_reg_bits {
+       u8         reserved_at_0[0x8];
+       u8         local_port[0x8];
+       u8         reserved_at_10[0x10];
++
+       u8         entropy_force_cap[0x1];
+       u8         entropy_calc_cap[0x1];
+       u8         entropy_gre_calc_cap[0x1];
+-      u8         reserved_at_23[0x1b];
++      u8         reserved_at_23[0xf];
++      u8         rx_ts_over_crc_cap[0x1];
++      u8         reserved_at_33[0xb];
+       u8         fcs_cap[0x1];
+       u8         reserved_at_3f[0x1];
++
+       u8         entropy_force[0x1];
+       u8         entropy_calc[0x1];
+       u8         entropy_gre_calc[0x1];
+-      u8         reserved_at_43[0x1b];
++      u8         reserved_at_43[0xf];
++      u8         rx_ts_over_crc[0x1];
++      u8         reserved_at_53[0xb];
+       u8         fcs_chk[0x1];
+       u8         reserved_at_5f[0x1];
+ };
diff --git a/queue-5.14/net-mlx5e-switchdev-representors-are-not-vlan-challenged.patch b/queue-5.14/net-mlx5e-switchdev-representors-are-not-vlan-challenged.patch
new file mode 100644 (file)
index 0000000..52b8d3e
--- /dev/null
@@ -0,0 +1,45 @@
+From b2107cdc43d8601f2cadfba990ae844cc1f44e68 Mon Sep 17 00:00:00 2001
+From: Saeed Mahameed <saeedm@nvidia.com>
+Date: Mon, 4 Oct 2021 21:20:25 -0700
+Subject: net/mlx5e: Switchdev representors are not vlan challenged
+
+From: Saeed Mahameed <saeedm@nvidia.com>
+
+commit b2107cdc43d8601f2cadfba990ae844cc1f44e68 upstream.
+
+Before this patch, mlx5 representors advertised the
+NETIF_F_VLAN_CHALLENGED bit, this could lead to missing features when
+using reps with vxlan/bridge and maybe other virtual interfaces,
+when such interfaces inherit this bit and block vlan usage in their
+topology.
+
+Example:
+$ip link add dev bridge type bridge
+ # add representor interface to the bridge
+$ip link set dev pf0hpf master
+$ip link add link bridge name vlan10 type vlan id 10 protocol 802.1q
+Error: 8021q: VLANs not supported on device.
+
+Reps are perfectly capable of handling vlan traffic, although they don't
+implement vlan_{add,kill}_vid ndos, hence, remove
+NETIF_F_VLAN_CHALLENGED advertisement.
+
+Fixes: cb67b832921c ("net/mlx5e: Introduce SRIOV VF representors")
+Reported-by: Roopa Prabhu <roopa@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Reviewed-by: Roi Dayan <roid@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+@@ -611,7 +611,6 @@ static void mlx5e_build_rep_netdev(struc
+       netdev->hw_features    |= NETIF_F_RXCSUM;
+       netdev->features |= netdev->hw_features;
+-      netdev->features |= NETIF_F_VLAN_CHALLENGED;
+       netdev->features |= NETIF_F_NETNS_LOCAL;
+ }
diff --git a/queue-5.14/net-phy-do-not-shutdown-phys-in-ready-state.patch b/queue-5.14/net-phy-do-not-shutdown-phys-in-ready-state.patch
new file mode 100644 (file)
index 0000000..11c8dc2
--- /dev/null
@@ -0,0 +1,35 @@
+From f49823939e41121fdffada4d583e3e38d28336f9 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Fri, 8 Oct 2021 14:42:52 -0700
+Subject: net: phy: Do not shutdown PHYs in READY state
+
+From: Florian Fainelli <f.fainelli@gmail.com>
+
+commit f49823939e41121fdffada4d583e3e38d28336f9 upstream.
+
+In case a PHY device was probed thus in the PHY_READY state, but not
+configured and with no network device attached yet, we should not be
+trying to shut it down because it has been brought back into reset by
+phy_device_reset() towards the end of phy_probe() and anyway we have not
+configured the PHY yet.
+
+Fixes: e2f016cf7751 ("net: phy: add a shutdown procedure")
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/phy/phy_device.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -3112,6 +3112,9 @@ static void phy_shutdown(struct device *
+ {
+       struct phy_device *phydev = to_phy_device(dev);
++      if (phydev->state == PHY_READY || !phydev->attached_dev)
++              return;
++
+       phy_disable_interrupts(phydev);
+ }
diff --git a/queue-5.14/net-smc-improved-fix-wait-on-already-cleared-link.patch b/queue-5.14/net-smc-improved-fix-wait-on-already-cleared-link.patch
new file mode 100644 (file)
index 0000000..2981ac5
--- /dev/null
@@ -0,0 +1,373 @@
+From 95f7f3e7dc6bd2e735cb5de11734ea2222b1e05a Mon Sep 17 00:00:00 2001
+From: Karsten Graul <kgraul@linux.ibm.com>
+Date: Thu, 7 Oct 2021 16:14:40 +0200
+Subject: net/smc: improved fix wait on already cleared link
+
+From: Karsten Graul <kgraul@linux.ibm.com>
+
+commit 95f7f3e7dc6bd2e735cb5de11734ea2222b1e05a upstream.
+
+Commit 8f3d65c16679 ("net/smc: fix wait on already cleared link")
+introduced link refcounting to avoid waits on already cleared links.
+This patch extents and improves the refcounting to cover all
+remaining possible cases for this kind of error situation.
+
+Fixes: 15e1b99aadfb ("net/smc: no WR buffer wait for terminating link group")
+Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/smc/smc_cdc.c  |    7 +++++
+ net/smc/smc_core.c |   20 +++++++++-------
+ net/smc/smc_llc.c  |   63 +++++++++++++++++++++++++++++++++++++++++------------
+ net/smc/smc_tx.c   |   22 ++++--------------
+ net/smc/smc_wr.h   |   14 +++++++++++
+ 5 files changed, 85 insertions(+), 41 deletions(-)
+
+--- a/net/smc/smc_cdc.c
++++ b/net/smc/smc_cdc.c
+@@ -150,9 +150,11 @@ static int smcr_cdc_get_slot_and_msg_sen
+ again:
+       link = conn->lnk;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_cdc_get_free_slot(conn, link, &wr_buf, NULL, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       spin_lock_bh(&conn->send_lock);
+       if (link != conn->lnk) {
+@@ -160,6 +162,7 @@ again:
+               spin_unlock_bh(&conn->send_lock);
+               smc_wr_tx_put_slot(link,
+                                  (struct smc_wr_tx_pend_priv *)pend);
++              smc_wr_tx_link_put(link);
+               if (again)
+                       return -ENOLINK;
+               again = true;
+@@ -167,6 +170,8 @@ again:
+       }
+       rc = smc_cdc_msg_send(conn, wr_buf, pend);
+       spin_unlock_bh(&conn->send_lock);
++put_out:
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+--- a/net/smc/smc_core.c
++++ b/net/smc/smc_core.c
+@@ -949,7 +949,7 @@ struct smc_link *smc_switch_conns(struct
+               to_lnk = &lgr->lnk[i];
+               break;
+       }
+-      if (!to_lnk) {
++      if (!to_lnk || !smc_wr_tx_link_hold(to_lnk)) {
+               smc_lgr_terminate_sched(lgr);
+               return NULL;
+       }
+@@ -981,24 +981,26 @@ again:
+               read_unlock_bh(&lgr->conns_lock);
+               /* pre-fetch buffer outside of send_lock, might sleep */
+               rc = smc_cdc_get_free_slot(conn, to_lnk, &wr_buf, NULL, &pend);
+-              if (rc) {
+-                      smcr_link_down_cond_sched(to_lnk);
+-                      return NULL;
+-              }
++              if (rc)
++                      goto err_out;
+               /* avoid race with smcr_tx_sndbuf_nonempty() */
+               spin_lock_bh(&conn->send_lock);
+               smc_switch_link_and_count(conn, to_lnk);
+               rc = smc_switch_cursor(smc, pend, wr_buf);
+               spin_unlock_bh(&conn->send_lock);
+               sock_put(&smc->sk);
+-              if (rc) {
+-                      smcr_link_down_cond_sched(to_lnk);
+-                      return NULL;
+-              }
++              if (rc)
++                      goto err_out;
+               goto again;
+       }
+       read_unlock_bh(&lgr->conns_lock);
++      smc_wr_tx_link_put(to_lnk);
+       return to_lnk;
++
++err_out:
++      smcr_link_down_cond_sched(to_lnk);
++      smc_wr_tx_link_put(to_lnk);
++      return NULL;
+ }
+ static void smcr_buf_unuse(struct smc_buf_desc *rmb_desc,
+--- a/net/smc/smc_llc.c
++++ b/net/smc/smc_llc.c
+@@ -383,9 +383,11 @@ int smc_llc_send_confirm_link(struct smc
+       struct smc_wr_buf *wr_buf;
+       int rc;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       confllc = (struct smc_llc_msg_confirm_link *)wr_buf;
+       memset(confllc, 0, sizeof(*confllc));
+       confllc->hd.common.type = SMC_LLC_CONFIRM_LINK;
+@@ -402,6 +404,8 @@ int smc_llc_send_confirm_link(struct smc
+       confllc->max_links = SMC_LLC_ADD_LNK_MAX_LINKS;
+       /* send llc message */
+       rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+@@ -415,9 +419,11 @@ static int smc_llc_send_confirm_rkey(str
+       struct smc_link *link;
+       int i, rc, rtok_ix;
++      if (!smc_wr_tx_link_hold(send_link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(send_link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       rkeyllc = (struct smc_llc_msg_confirm_rkey *)wr_buf;
+       memset(rkeyllc, 0, sizeof(*rkeyllc));
+       rkeyllc->hd.common.type = SMC_LLC_CONFIRM_RKEY;
+@@ -444,6 +450,8 @@ static int smc_llc_send_confirm_rkey(str
+               (u64)sg_dma_address(rmb_desc->sgt[send_link->link_idx].sgl));
+       /* send llc message */
+       rc = smc_wr_tx_send(send_link, pend);
++put_out:
++      smc_wr_tx_link_put(send_link);
+       return rc;
+ }
+@@ -456,9 +464,11 @@ static int smc_llc_send_delete_rkey(stru
+       struct smc_wr_buf *wr_buf;
+       int rc;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       rkeyllc = (struct smc_llc_msg_delete_rkey *)wr_buf;
+       memset(rkeyllc, 0, sizeof(*rkeyllc));
+       rkeyllc->hd.common.type = SMC_LLC_DELETE_RKEY;
+@@ -467,6 +477,8 @@ static int smc_llc_send_delete_rkey(stru
+       rkeyllc->rkey[0] = htonl(rmb_desc->mr_rx[link->link_idx]->rkey);
+       /* send llc message */
+       rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+@@ -480,9 +492,11 @@ int smc_llc_send_add_link(struct smc_lin
+       struct smc_wr_buf *wr_buf;
+       int rc;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       addllc = (struct smc_llc_msg_add_link *)wr_buf;
+       memset(addllc, 0, sizeof(*addllc));
+@@ -504,6 +518,8 @@ int smc_llc_send_add_link(struct smc_lin
+       }
+       /* send llc message */
+       rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+@@ -517,9 +533,11 @@ int smc_llc_send_delete_link(struct smc_
+       struct smc_wr_buf *wr_buf;
+       int rc;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       delllc = (struct smc_llc_msg_del_link *)wr_buf;
+       memset(delllc, 0, sizeof(*delllc));
+@@ -536,6 +554,8 @@ int smc_llc_send_delete_link(struct smc_
+       delllc->reason = htonl(reason);
+       /* send llc message */
+       rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+@@ -547,9 +567,11 @@ static int smc_llc_send_test_link(struct
+       struct smc_wr_buf *wr_buf;
+       int rc;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       testllc = (struct smc_llc_msg_test_link *)wr_buf;
+       memset(testllc, 0, sizeof(*testllc));
+       testllc->hd.common.type = SMC_LLC_TEST_LINK;
+@@ -557,6 +579,8 @@ static int smc_llc_send_test_link(struct
+       memcpy(testllc->user_data, user_data, sizeof(testllc->user_data));
+       /* send llc message */
+       rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+@@ -567,13 +591,16 @@ static int smc_llc_send_message(struct s
+       struct smc_wr_buf *wr_buf;
+       int rc;
+-      if (!smc_link_usable(link))
++      if (!smc_wr_tx_link_hold(link))
+               return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       memcpy(wr_buf, llcbuf, sizeof(union smc_llc_msg));
+-      return smc_wr_tx_send(link, pend);
++      rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
++      return rc;
+ }
+ /* schedule an llc send on link, may wait for buffers,
+@@ -586,13 +613,16 @@ static int smc_llc_send_message_wait(str
+       struct smc_wr_buf *wr_buf;
+       int rc;
+-      if (!smc_link_usable(link))
++      if (!smc_wr_tx_link_hold(link))
+               return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       memcpy(wr_buf, llcbuf, sizeof(union smc_llc_msg));
+-      return smc_wr_tx_send_wait(link, pend, SMC_LLC_WAIT_TIME);
++      rc = smc_wr_tx_send_wait(link, pend, SMC_LLC_WAIT_TIME);
++put_out:
++      smc_wr_tx_link_put(link);
++      return rc;
+ }
+ /********************************* receive ***********************************/
+@@ -672,9 +702,11 @@ static int smc_llc_add_link_cont(struct
+       struct smc_buf_desc *rmb;
+       u8 n;
++      if (!smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_llc_add_pending_send(link, &wr_buf, &pend);
+       if (rc)
+-              return rc;
++              goto put_out;
+       addc_llc = (struct smc_llc_msg_add_link_cont *)wr_buf;
+       memset(addc_llc, 0, sizeof(*addc_llc));
+@@ -706,7 +738,10 @@ static int smc_llc_add_link_cont(struct
+       addc_llc->hd.length = sizeof(struct smc_llc_msg_add_link_cont);
+       if (lgr->role == SMC_CLNT)
+               addc_llc->hd.flags |= SMC_LLC_FLAG_RESP;
+-      return smc_wr_tx_send(link, pend);
++      rc = smc_wr_tx_send(link, pend);
++put_out:
++      smc_wr_tx_link_put(link);
++      return rc;
+ }
+ static int smc_llc_cli_rkey_exchange(struct smc_link *link,
+--- a/net/smc/smc_tx.c
++++ b/net/smc/smc_tx.c
+@@ -496,7 +496,7 @@ static int smc_tx_rdma_writes(struct smc
+ /* Wakeup sndbuf consumers from any context (IRQ or process)
+  * since there is more data to transmit; usable snd_wnd as max transmit
+  */
+-static int _smcr_tx_sndbuf_nonempty(struct smc_connection *conn)
++static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn)
+ {
+       struct smc_cdc_producer_flags *pflags = &conn->local_tx_ctrl.prod_flags;
+       struct smc_link *link = conn->lnk;
+@@ -505,8 +505,11 @@ static int _smcr_tx_sndbuf_nonempty(stru
+       struct smc_wr_buf *wr_buf;
+       int rc;
++      if (!link || !smc_wr_tx_link_hold(link))
++              return -ENOLINK;
+       rc = smc_cdc_get_free_slot(conn, link, &wr_buf, &wr_rdma_buf, &pend);
+       if (rc < 0) {
++              smc_wr_tx_link_put(link);
+               if (rc == -EBUSY) {
+                       struct smc_sock *smc =
+                               container_of(conn, struct smc_sock, conn);
+@@ -547,22 +550,7 @@ static int _smcr_tx_sndbuf_nonempty(stru
+ out_unlock:
+       spin_unlock_bh(&conn->send_lock);
+-      return rc;
+-}
+-
+-static int smcr_tx_sndbuf_nonempty(struct smc_connection *conn)
+-{
+-      struct smc_link *link = conn->lnk;
+-      int rc = -ENOLINK;
+-
+-      if (!link)
+-              return rc;
+-
+-      atomic_inc(&link->wr_tx_refcnt);
+-      if (smc_link_usable(link))
+-              rc = _smcr_tx_sndbuf_nonempty(conn);
+-      if (atomic_dec_and_test(&link->wr_tx_refcnt))
+-              wake_up_all(&link->wr_tx_wait);
++      smc_wr_tx_link_put(link);
+       return rc;
+ }
+--- a/net/smc/smc_wr.h
++++ b/net/smc/smc_wr.h
+@@ -60,6 +60,20 @@ static inline void smc_wr_tx_set_wr_id(a
+       atomic_long_set(wr_tx_id, val);
+ }
++static inline bool smc_wr_tx_link_hold(struct smc_link *link)
++{
++      if (!smc_link_usable(link))
++              return false;
++      atomic_inc(&link->wr_tx_refcnt);
++      return true;
++}
++
++static inline void smc_wr_tx_link_put(struct smc_link *link)
++{
++      if (atomic_dec_and_test(&link->wr_tx_refcnt))
++              wake_up_all(&link->wr_tx_wait);
++}
++
+ static inline void smc_wr_wakeup_tx_wait(struct smc_link *lnk)
+ {
+       wake_up_all(&lnk->wr_tx_wait);
diff --git a/queue-5.14/net-stmmac-fix-get_hw_feature-on-old-hardware.patch b/queue-5.14/net-stmmac-fix-get_hw_feature-on-old-hardware.patch
new file mode 100644 (file)
index 0000000..6635712
--- /dev/null
@@ -0,0 +1,132 @@
+From 075da584bae2da6a37428d59a477b6bdad430ac3 Mon Sep 17 00:00:00 2001
+From: Herve Codina <herve.codina@bootlin.com>
+Date: Fri, 8 Oct 2021 12:34:37 +0200
+Subject: net: stmmac: fix get_hw_feature() on old hardware
+
+From: Herve Codina <herve.codina@bootlin.com>
+
+commit 075da584bae2da6a37428d59a477b6bdad430ac3 upstream.
+
+Some old IPs do not provide the hardware feature register.
+On these IPs, this register is read 0x00000000.
+
+In old driver version, this feature was handled but a regression came
+with the commit f10a6a3541b4 ("stmmac: rework get_hw_feature function").
+Indeed, this commit removes the return value in dma->get_hw_feature().
+This return value was used to indicate the validity of retrieved
+information and used later on in stmmac_hw_init() to override
+priv->plat data if this hardware feature were valid.
+
+This patch restores the return code in ->get_hw_feature() in order
+to indicate the hardware feature validity and override priv->plat
+data only if this hardware feature is valid.
+
+Fixes: f10a6a3541b4 ("stmmac: rework get_hw_feature function")
+Signed-off-by: Herve Codina <herve.codina@bootlin.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c |   13 +++++++++++--
+ drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c    |    6 ++++--
+ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c  |    6 ++++--
+ drivers/net/ethernet/stmicro/stmmac/hwif.h          |    6 +++---
+ 4 files changed, 22 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+@@ -218,11 +218,18 @@ static void dwmac1000_dump_dma_regs(void
+                               readl(ioaddr + DMA_BUS_MODE + i * 4);
+ }
+-static void dwmac1000_get_hw_feature(void __iomem *ioaddr,
+-                                   struct dma_features *dma_cap)
++static int dwmac1000_get_hw_feature(void __iomem *ioaddr,
++                                  struct dma_features *dma_cap)
+ {
+       u32 hw_cap = readl(ioaddr + DMA_HW_FEATURE);
++      if (!hw_cap) {
++              /* 0x00000000 is the value read on old hardware that does not
++               * implement this register
++               */
++              return -EOPNOTSUPP;
++      }
++
+       dma_cap->mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL);
+       dma_cap->mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1;
+       dma_cap->half_duplex = (hw_cap & DMA_HW_FEAT_HDSEL) >> 2;
+@@ -252,6 +259,8 @@ static void dwmac1000_get_hw_feature(voi
+       dma_cap->number_tx_channel = (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22;
+       /* Alternate (enhanced) DESC mode */
+       dma_cap->enh_desc = (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24;
++
++      return 0;
+ }
+ static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt,
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+@@ -347,8 +347,8 @@ static void dwmac4_dma_tx_chan_op_mode(v
+       writel(mtl_tx_op, ioaddr +  MTL_CHAN_TX_OP_MODE(channel));
+ }
+-static void dwmac4_get_hw_feature(void __iomem *ioaddr,
+-                                struct dma_features *dma_cap)
++static int dwmac4_get_hw_feature(void __iomem *ioaddr,
++                               struct dma_features *dma_cap)
+ {
+       u32 hw_cap = readl(ioaddr + GMAC_HW_FEATURE0);
+@@ -437,6 +437,8 @@ static void dwmac4_get_hw_feature(void _
+       dma_cap->frpbs = (hw_cap & GMAC_HW_FEAT_FRPBS) >> 11;
+       dma_cap->frpsel = (hw_cap & GMAC_HW_FEAT_FRPSEL) >> 10;
+       dma_cap->dvlan = (hw_cap & GMAC_HW_FEAT_DVLAN) >> 5;
++
++      return 0;
+ }
+ /* Enable/disable TSO feature and set MSS */
+--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+@@ -371,8 +371,8 @@ static int dwxgmac2_dma_interrupt(void _
+       return ret;
+ }
+-static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,
+-                                  struct dma_features *dma_cap)
++static int dwxgmac2_get_hw_feature(void __iomem *ioaddr,
++                                 struct dma_features *dma_cap)
+ {
+       u32 hw_cap;
+@@ -445,6 +445,8 @@ static void dwxgmac2_get_hw_feature(void
+       dma_cap->frpes = (hw_cap & XGMAC_HWFEAT_FRPES) >> 11;
+       dma_cap->frpbs = (hw_cap & XGMAC_HWFEAT_FRPPB) >> 9;
+       dma_cap->frpsel = (hw_cap & XGMAC_HWFEAT_FRPSEL) >> 3;
++
++      return 0;
+ }
+ static void dwxgmac2_rx_watchdog(void __iomem *ioaddr, u32 riwt, u32 queue)
+--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
+@@ -203,8 +203,8 @@ struct stmmac_dma_ops {
+       int (*dma_interrupt) (void __iomem *ioaddr,
+                             struct stmmac_extra_stats *x, u32 chan, u32 dir);
+       /* If supported then get the optional core features */
+-      void (*get_hw_feature)(void __iomem *ioaddr,
+-                             struct dma_features *dma_cap);
++      int (*get_hw_feature)(void __iomem *ioaddr,
++                            struct dma_features *dma_cap);
+       /* Program the HW RX Watchdog */
+       void (*rx_watchdog)(void __iomem *ioaddr, u32 riwt, u32 queue);
+       void (*set_tx_ring_len)(void __iomem *ioaddr, u32 len, u32 chan);
+@@ -255,7 +255,7 @@ struct stmmac_dma_ops {
+ #define stmmac_dma_interrupt_status(__priv, __args...) \
+       stmmac_do_callback(__priv, dma, dma_interrupt, __args)
+ #define stmmac_get_hw_feature(__priv, __args...) \
+-      stmmac_do_void_callback(__priv, dma, get_hw_feature, __args)
++      stmmac_do_callback(__priv, dma, get_hw_feature, __args)
+ #define stmmac_rx_watchdog(__priv, __args...) \
+       stmmac_do_void_callback(__priv, dma, rx_watchdog, __args)
+ #define stmmac_set_tx_ring_len(__priv, __args...) \
diff --git a/queue-5.14/nvme-pci-fix-abort-command-id.patch b/queue-5.14/nvme-pci-fix-abort-command-id.patch
new file mode 100644 (file)
index 0000000..e8430a2
--- /dev/null
@@ -0,0 +1,30 @@
+From 85f74acf097a63a07f5a7c215db6883e5c35e3ff Mon Sep 17 00:00:00 2001
+From: Keith Busch <kbusch@kernel.org>
+Date: Wed, 6 Oct 2021 23:50:31 -0700
+Subject: nvme-pci: Fix abort command id
+
+From: Keith Busch <kbusch@kernel.org>
+
+commit 85f74acf097a63a07f5a7c215db6883e5c35e3ff upstream.
+
+The request tag is no longer the only component of the command id.
+
+Fixes: e7006de6c2380 ("nvme: code command_id with a genctr for use-after-free validation")
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/nvme/host/pci.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/nvme/host/pci.c
++++ b/drivers/nvme/host/pci.c
+@@ -1331,7 +1331,7 @@ static enum blk_eh_timer_return nvme_tim
+       iod->aborted = 1;
+       cmd.abort.opcode = nvme_admin_abort_cmd;
+-      cmd.abort.cid = req->tag;
++      cmd.abort.cid = nvme_cid(req);
+       cmd.abort.sqid = cpu_to_le16(nvmeq->qid);
+       dev_warn(nvmeq->dev->ctrl.device,
diff --git a/queue-5.14/sctp-account-stream-padding-length-for-reconf-chunk.patch b/queue-5.14/sctp-account-stream-padding-length-for-reconf-chunk.patch
new file mode 100644 (file)
index 0000000..e05e247
--- /dev/null
@@ -0,0 +1,44 @@
+From a2d859e3fc97e79d907761550dbc03ff1b36479c Mon Sep 17 00:00:00 2001
+From: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
+Date: Wed, 13 Oct 2021 17:27:29 -0300
+Subject: sctp: account stream padding length for reconf chunk
+
+From: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
+
+commit a2d859e3fc97e79d907761550dbc03ff1b36479c upstream.
+
+sctp_make_strreset_req() makes repeated calls to sctp_addto_chunk()
+which will automatically account for padding on each call. inreq and
+outreq are already 4 bytes aligned, but the payload is not and doing
+SCTP_PAD4(a + b) (which _sctp_make_chunk() did implicitly here) is
+different from SCTP_PAD4(a) + SCTP_PAD4(b) and not enough. It led to
+possible attempt to use more buffer than it was allocated and triggered
+a BUG_ON.
+
+Cc: Vlad Yasevich <vyasevich@gmail.com>
+Cc: Neil Horman <nhorman@tuxdriver.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Fixes: cc16f00f6529 ("sctp: add support for generating stream reconf ssn reset request chunk")
+Reported-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
+Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
+Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
+Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
+Reviewed-by: Xin Long <lucien.xin@gmail.com>
+Link: https://lore.kernel.org/r/b97c1f8b0c7ff79ac4ed206fc2c49d3612e0850c.1634156849.git.mleitner@redhat.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/sctp/sm_make_chunk.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/sctp/sm_make_chunk.c
++++ b/net/sctp/sm_make_chunk.c
+@@ -3697,7 +3697,7 @@ struct sctp_chunk *sctp_make_strreset_re
+       outlen = (sizeof(outreq) + stream_len) * out;
+       inlen = (sizeof(inreq) + stream_len) * in;
+-      retval = sctp_make_reconf(asoc, outlen + inlen);
++      retval = sctp_make_reconf(asoc, SCTP_PAD4(outlen) + SCTP_PAD4(inlen));
+       if (!retval)
+               return NULL;
index ab208d115af5442fc42fef68f70d1a0c6c92a4cc..dd1ad4232883209d74a3ae21e95c1acae21e3451 100644 (file)
@@ -94,3 +94,20 @@ firmware-arm_ffa-add-missing-remove-callback-to-ffa_bus_type.patch
 arm-dts-bcm2711-rpi-4-b-fix-sd_io_1v8_reg-regulator-states.patch
 arm-dts-bcm2711-rpi-4-b-fix-pcie0-s-unit-address-formatting.patch
 clk-renesas-rzg2l-fix-clk-status-function.patch
+nvme-pci-fix-abort-command-id.patch
+sctp-account-stream-padding-length-for-reconf-chunk.patch
+gpio-74x164-add-spi-device-id-table.patch
+gpio-pca953x-improve-bias-setting.patch
+net-arc-select-crc32.patch
+net-korina-select-crc32.patch
+net-smc-improved-fix-wait-on-already-cleared-link.patch
+net-mlx5e-fix-memory-leak-in-mlx5_core_destroy_cq-error-path.patch
+net-mlx5e-mutually-exclude-rx-fcs-and-rx-port-timestamp.patch
+net-mlx5e-switchdev-representors-are-not-vlan-challenged.patch
+net-stmmac-fix-get_hw_feature-on-old-hardware.patch
+net-phy-do-not-shutdown-phys-in-ready-state.patch
+net-dsa-mv88e6xxx-don-t-use-phy_detect-on-internal-phy-s.patch
+net-dsa-microchip-added-the-condition-for-scheduling-ksz_mib_read_work.patch
+net-dsa-fix-spurious-error-message-when-unoffloaded-port-leaves-bridge.patch
+net-encx24j600-check-error-in-devm_regmap_init_encx24j600.patch
+ethernet-s2io-fix-setting-mac-address-during-resume.patch