]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Mon, 31 Oct 2022 10:23:22 +0000 (06:23 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 31 Oct 2022 10:23:22 +0000 (06:23 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
72 files changed:
queue-5.15/alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch [new file with mode: 0644]
queue-5.15/alsa-aoa-fix-i2s-device-accounting.patch [new file with mode: 0644]
queue-5.15/alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch [new file with mode: 0644]
queue-5.15/amd-xgbe-add-the-bit-rate-quirk-for-molex-cables.patch [new file with mode: 0644]
queue-5.15/amd-xgbe-fix-the-sfp-compliance-codes-check-for-dac-.patch [new file with mode: 0644]
queue-5.15/arc-iounmap-arg-is-volatile.patch [new file with mode: 0644]
queue-5.15/arm64-add-ampere1-to-the-spectre-bhb-affected-list.patch [new file with mode: 0644]
queue-5.15/asoc-qcom-lpass-cpu-mark-hdmi-tx-parity-register-as-.patch [new file with mode: 0644]
queue-5.15/asoc-qcom-lpass-cpu-mark-hdmi-tx-registers-as-volati.patch [new file with mode: 0644]
queue-5.15/atlantic-fix-deadlock-at-aq_nic_stop.patch [new file with mode: 0644]
queue-5.15/can-mcp251x-mcp251x_can_probe-add-missing-unregister.patch [new file with mode: 0644]
queue-5.15/can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch [new file with mode: 0644]
queue-5.15/drm-amdkfd-fix-memory-leak-in-kfd_mem_dmamap_userptr.patch [new file with mode: 0644]
queue-5.15/drm-i915-dp-reset-frl-trained-flag-before-restarting.patch [new file with mode: 0644]
queue-5.15/drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch [new file with mode: 0644]
queue-5.15/i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch [new file with mode: 0644]
queue-5.15/i40e-fix-flow-type-by-setting-gl_hash_inset-register.patch [new file with mode: 0644]
queue-5.15/i40e-fix-vf-hang-when-reset-is-triggered-on-another-.patch [new file with mode: 0644]
queue-5.15/ipv6-ensure-sane-device-mtu-in-tunnels.patch [new file with mode: 0644]
queue-5.15/kcm-annotate-data-races-around-kcm-rx_psock.patch [new file with mode: 0644]
queue-5.15/kcm-annotate-data-races-around-kcm-rx_wait.patch [new file with mode: 0644]
queue-5.15/kcm-do-not-sense-pfmemalloc-status-in-kcm_sendpage.patch [new file with mode: 0644]
queue-5.15/kvm-selftests-fix-number-of-pages-for-memory-slot-in.patch [new file with mode: 0644]
queue-5.15/media-atomisp-prevent-integer-overflow-in-sh_css_set.patch [new file with mode: 0644]
queue-5.15/media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch [new file with mode: 0644]
queue-5.15/media-v4l2-fix-v4l2_i2c_subdev_set_name-function-doc.patch [new file with mode: 0644]
queue-5.15/media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch [new file with mode: 0644]
queue-5.15/media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch [new file with mode: 0644]
queue-5.15/media-vivid-s_fbuf-add-more-sanity-checks.patch [new file with mode: 0644]
queue-5.15/media-vivid-set-num_in-outputs-to-0-if-not-supported.patch [new file with mode: 0644]
queue-5.15/mtd-rawnand-intel-add-missing-of_node_put-in-ebu_nan.patch [new file with mode: 0644]
queue-5.15/net-bcmsysport-indicate-mac-is-in-charge-of-phy-pm.patch [new file with mode: 0644]
queue-5.15/net-broadcom-bcm4908_enet-update-tx-stats-after-actu.patch [new file with mode: 0644]
queue-5.15/net-broadcom-bcm4908enet-remove-redundant-variable-b.patch [new file with mode: 0644]
queue-5.15/net-do-not-sense-pfmemalloc-status-in-skb_append_pag.patch [new file with mode: 0644]
queue-5.15/net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch [new file with mode: 0644]
queue-5.15/net-enetc-survive-memory-pressure-without-crashing.patch [new file with mode: 0644]
queue-5.15/net-ethernet-ave-fix-mac-to-be-in-charge-of-phy-pm.patch [new file with mode: 0644]
queue-5.15/net-fec-limit-register-access-on-i.mx6ul.patch [new file with mode: 0644]
queue-5.15/net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch [new file with mode: 0644]
queue-5.15/net-hinic-fix-incorrect-assignment-issue-in-hinic_se.patch [new file with mode: 0644]
queue-5.15/net-hinic-fix-memory-leak-when-reading-function-tabl.patch [new file with mode: 0644]
queue-5.15/net-hinic-fix-the-issue-of-cmdq-memory-leaks.patch [new file with mode: 0644]
queue-5.15/net-hinic-fix-the-issue-of-double-release-mbox-callb.patch [new file with mode: 0644]
queue-5.15/net-ksz884x-fix-missing-pci_disable_device-on-error-.patch [new file with mode: 0644]
queue-5.15/net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch [new file with mode: 0644]
queue-5.15/net-macb-specify-phy-pm-management-done-by-mac.patch [new file with mode: 0644]
queue-5.15/net-memcg-avoid-stalls-when-under-memory-pressure.patch [new file with mode: 0644]
queue-5.15/net-mlx5-fix-crash-during-sync-firmware-reset.patch [new file with mode: 0644]
queue-5.15/net-mlx5-fix-possible-use-after-free-in-async-comman.patch [new file with mode: 0644]
queue-5.15/net-mlx5-print-more-info-on-pci-error-handlers.patch [new file with mode: 0644]
queue-5.15/net-mlx5-update-fw-fatal-reporter-state-on-pci-handl.patch [new file with mode: 0644]
queue-5.15/net-mlx5e-do-not-increment-esn-when-updating-ipsec-e.patch [new file with mode: 0644]
queue-5.15/net-mlx5e-extend-skb-room-check-to-include-ptp-sq.patch [new file with mode: 0644]
queue-5.15/net-netsec-fix-error-handling-in-netsec_register_mdi.patch [new file with mode: 0644]
queue-5.15/netdevsim-remove-dir-in-nsim_dev_debugfs_init-when-c.patch [new file with mode: 0644]
queue-5.15/nfc-virtual_ncidev-fix-memory-leak-in-virtual_nci_se.patch [new file with mode: 0644]
queue-5.15/nh-fix-scope-used-to-find-saddr-when-adding-non-gw-n.patch [new file with mode: 0644]
queue-5.15/openvswitch-switch-from-warn-to-pr_warn.patch [new file with mode: 0644]
queue-5.15/perf-fix-missing-sigtraps.patch [new file with mode: 0644]
queue-5.15/perf-vendor-events-arm64-fix-incorrect-hisi-hip08-l3.patch [new file with mode: 0644]
queue-5.15/perf-vendor-events-power10-fix-hv-24x7-metric-events.patch [new file with mode: 0644]
queue-5.15/perf-x86-intel-lbr-use-setup_clear_cpu_cap-instead-o.patch [new file with mode: 0644]
queue-5.15/pm-domains-fix-handling-of-unavailable-disabled-idle.patch [new file with mode: 0644]
queue-5.15/pm-hibernate-allow-hybrid-sleep-to-work-with-s2idle.patch [new file with mode: 0644]
queue-5.15/sched-core-fix-comparison-in-sched_group_cookie_matc.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/tcp-fix-a-signed-integer-overflow-bug-in-tcp_add_bac.patch [new file with mode: 0644]
queue-5.15/tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch [new file with mode: 0644]
queue-5.15/tcp-minor-optimization-in-tcp_add_backlog.patch [new file with mode: 0644]
queue-5.15/tipc-fix-a-null-ptr-deref-in-tipc_topsrv_accept.patch [new file with mode: 0644]
queue-5.15/x86-unwind-orc-fix-unreliable-stack-dump-with-gcov.patch [new file with mode: 0644]

diff --git a/queue-5.15/alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch b/queue-5.15/alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch
new file mode 100644 (file)
index 0000000..9bae03f
--- /dev/null
@@ -0,0 +1,37 @@
+From b32a7585ee0a536bcce068239aa7830b49c994c0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 17:30:25 +0800
+Subject: ALSA: ac97: fix possible memory leak in snd_ac97_dev_register()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 4881bda5ea05c8c240fc8afeaa928e2bc43f61fa ]
+
+If device_register() fails in snd_ac97_dev_register(), it should
+call put_device() to give up reference, or the name allocated in
+dev_set_name() is leaked.
+
+Fixes: 0ca06a00e206 ("[ALSA] AC97 bus interface for ad-hoc drivers")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221019093025.1179475-1-yangyingliang@huawei.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/ac97/ac97_codec.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
+index cb60a07d39a8..ceead55f13ab 100644
+--- a/sound/pci/ac97/ac97_codec.c
++++ b/sound/pci/ac97/ac97_codec.c
+@@ -2009,6 +2009,7 @@ static int snd_ac97_dev_register(struct snd_device *device)
+       err = device_register(&ac97->dev);
+       if (err < 0) {
+               ac97_err(ac97, "Can't register ac97 bus\n");
++              put_device(&ac97->dev);
+               ac97->dev.bus = NULL;
+               return err;
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/alsa-aoa-fix-i2s-device-accounting.patch b/queue-5.15/alsa-aoa-fix-i2s-device-accounting.patch
new file mode 100644 (file)
index 0000000..ce3c2c7
--- /dev/null
@@ -0,0 +1,49 @@
+From 4996a93ae5302e4b02392fa7f1689813d42da392 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 08:52:33 +0200
+Subject: ALSA: aoa: Fix I2S device accounting
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit f1fae475f10a26b7e34da4ff2e2f19b7feb3548e ]
+
+i2sbus_add_dev() is supposed to return the number of probed devices,
+i.e. either 1 or 0.  However, i2sbus_add_dev() has one error handling
+that returns -ENODEV; this will screw up the accumulation number
+counted in the caller, i2sbus_probe().
+
+Fix the return value to 0 and add the comment for better understanding
+for readers.
+
+Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
+Link: https://lore.kernel.org/r/20221027065233.13292-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/aoa/soundbus/i2sbus/core.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
+index f6841daf9e3b..51ed2f34b276 100644
+--- a/sound/aoa/soundbus/i2sbus/core.c
++++ b/sound/aoa/soundbus/i2sbus/core.c
+@@ -147,6 +147,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node *np, int index,
+       return rc;
+ }
++/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
+ /* FIXME: look at device node refcounting */
+ static int i2sbus_add_dev(struct macio_dev *macio,
+                         struct i2sbus_control *control,
+@@ -213,7 +214,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
+        * either as the second one in that case is just a modem. */
+       if (!ok) {
+               kfree(dev);
+-              return -ENODEV;
++              return 0;
+       }
+       mutex_init(&dev->lock);
+-- 
+2.35.1
+
diff --git a/queue-5.15/alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch b/queue-5.15/alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch
new file mode 100644 (file)
index 0000000..a9cb3a5
--- /dev/null
@@ -0,0 +1,42 @@
+From a2c25891bbd7170c46f77c4e92c41c2814448da4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 09:34:38 +0800
+Subject: ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 4a4c8482e370d697738a78dcd7bf2780832cb712 ]
+
+dev_set_name() in soundbus_add_one() allocates memory for name, it need be
+freed when of_device_register() fails, call soundbus_dev_put() to give up
+the reference that hold in device_initialize(), so that it can be freed in
+kobject_cleanup() when the refcount hit to 0. And other resources are also
+freed in i2sbus_release_dev(), so it can return 0 directly.
+
+Fixes: f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221027013438.991920-1-yangyingliang@huawei.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/aoa/soundbus/i2sbus/core.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
+index faf6b03131ee..f6841daf9e3b 100644
+--- a/sound/aoa/soundbus/i2sbus/core.c
++++ b/sound/aoa/soundbus/i2sbus/core.c
+@@ -302,6 +302,10 @@ static int i2sbus_add_dev(struct macio_dev *macio,
+       if (soundbus_add_one(&dev->sound)) {
+               printk(KERN_DEBUG "i2sbus: device registration error!\n");
++              if (dev->sound.ofdev.dev.kobj.state_initialized) {
++                      soundbus_dev_put(&dev->sound);
++                      return 0;
++              }
+               goto err;
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/amd-xgbe-add-the-bit-rate-quirk-for-molex-cables.patch b/queue-5.15/amd-xgbe-add-the-bit-rate-quirk-for-molex-cables.patch
new file mode 100644 (file)
index 0000000..6ab74d2
--- /dev/null
@@ -0,0 +1,61 @@
+From df23fcfc59f08ed98b79a4f695b6027fc3606d3b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 12:12:15 +0530
+Subject: amd-xgbe: add the bit rate quirk for Molex cables
+
+From: Raju Rangoju <Raju.Rangoju@amd.com>
+
+[ Upstream commit 170a9e341a3b02c0b2ea0df16ef14a33a4f41de8 ]
+
+The offset 12 (bit-rate) of EEPROM SFP DAC (passive) cables is expected
+to be in the range 0x64 to 0x68. However, the 5 meter and 7 meter Molex
+passive cables have the rate ceiling 0x78 at offset 12.
+
+Add a quirk for Molex passive cables to extend the rate ceiling to 0x78.
+
+Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
+Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
+Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+index 21e38b720d87..a7166cd1179f 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+@@ -239,6 +239,7 @@ enum xgbe_sfp_speed {
+ #define XGBE_SFP_BASE_BR_1GBE_MAX             0x0d
+ #define XGBE_SFP_BASE_BR_10GBE_MIN            0x64
+ #define XGBE_SFP_BASE_BR_10GBE_MAX            0x68
++#define XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX      0x78
+ #define XGBE_SFP_BASE_CU_CABLE_LEN            18
+@@ -284,6 +285,8 @@ struct xgbe_sfp_eeprom {
+ #define XGBE_BEL_FUSE_VENDOR  "BEL-FUSE        "
+ #define XGBE_BEL_FUSE_PARTNO  "1GBT-SFP06      "
++#define XGBE_MOLEX_VENDOR     "Molex Inc.      "
++
+ struct xgbe_sfp_ascii {
+       union {
+               char vendor[XGBE_SFP_BASE_VENDOR_NAME_LEN + 1];
+@@ -834,7 +837,11 @@ static bool xgbe_phy_sfp_bit_rate(struct xgbe_sfp_eeprom *sfp_eeprom,
+               break;
+       case XGBE_SFP_SPEED_10000:
+               min = XGBE_SFP_BASE_BR_10GBE_MIN;
+-              max = XGBE_SFP_BASE_BR_10GBE_MAX;
++              if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME],
++                         XGBE_MOLEX_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN) == 0)
++                      max = XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX;
++              else
++                      max = XGBE_SFP_BASE_BR_10GBE_MAX;
+               break;
+       default:
+               return false;
+-- 
+2.35.1
+
diff --git a/queue-5.15/amd-xgbe-fix-the-sfp-compliance-codes-check-for-dac-.patch b/queue-5.15/amd-xgbe-fix-the-sfp-compliance-codes-check-for-dac-.patch
new file mode 100644 (file)
index 0000000..3cb11c5
--- /dev/null
@@ -0,0 +1,54 @@
+From 8f6da43b3253761dab43392ee3b307b48e8f12e7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 12:12:14 +0530
+Subject: amd-xgbe: fix the SFP compliance codes check for DAC cables
+
+From: Raju Rangoju <Raju.Rangoju@amd.com>
+
+[ Upstream commit 09c5f6bf11ac98874339e55f4f5f79a9dbc9b375 ]
+
+The current XGBE code assumes that offset 6 of EEPROM SFP DAC (passive)
+cables is NULL. However, some cables (the 5 meter and 7 meter Molex
+passive cables) have non-zero data at offset 6. Fix the logic by moving
+the passive cable check above the active checks, so as not to be
+improperly identified as an active cable. This will fix the issue for
+any passive cable that advertises 1000Base-CX in offset 6.
+
+Fixes: abf0a1c2b26a ("amd-xgbe: Add support for SFP+ modules")
+Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
+Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+index 213769054391..21e38b720d87 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+@@ -1151,7 +1151,10 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
+       }
+       /* Determine the type of SFP */
+-      if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)
++      if (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE &&
++          xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))
++              phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;
++      else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR)
+               phy_data->sfp_base = XGBE_SFP_BASE_10000_SR;
+       else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_LR)
+               phy_data->sfp_base = XGBE_SFP_BASE_10000_LR;
+@@ -1167,9 +1170,6 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
+               phy_data->sfp_base = XGBE_SFP_BASE_1000_CX;
+       else if (sfp_base[XGBE_SFP_BASE_1GBE_CC] & XGBE_SFP_BASE_1GBE_CC_T)
+               phy_data->sfp_base = XGBE_SFP_BASE_1000_T;
+-      else if ((phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE) &&
+-               xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000))
+-              phy_data->sfp_base = XGBE_SFP_BASE_10000_CR;
+       switch (phy_data->sfp_base) {
+       case XGBE_SFP_BASE_1000_T:
+-- 
+2.35.1
+
diff --git a/queue-5.15/arc-iounmap-arg-is-volatile.patch b/queue-5.15/arc-iounmap-arg-is-volatile.patch
new file mode 100644 (file)
index 0000000..c6d11b6
--- /dev/null
@@ -0,0 +1,59 @@
+From 533777e99c87f4aa11efd0fbee55d7543964a78b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 9 Oct 2022 19:28:46 -0700
+Subject: arc: iounmap() arg is volatile
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit c44f15c1c09481d50fd33478ebb5b8284f8f5edb ]
+
+Add 'volatile' to iounmap()'s argument to prevent build warnings.
+This make it the same as other major architectures.
+
+Placates these warnings: (12 such warnings)
+
+../drivers/video/fbdev/riva/fbdev.c: In function 'rivafb_probe':
+../drivers/video/fbdev/riva/fbdev.c:2067:42: error: passing argument 1 of 'iounmap' discards 'volatile' qualifier from pointer target type [-Werror=discarded-qualifiers]
+ 2067 |                 iounmap(default_par->riva.PRAMIN);
+
+Fixes: 1162b0701b14b ("ARC: I/O and DMA Mappings")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Cc: Vineet Gupta <vgupta@kernel.org>
+Cc: linux-snps-arc@lists.infradead.org
+Cc: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Vineet Gupta <vgupta@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arc/include/asm/io.h | 2 +-
+ arch/arc/mm/ioremap.c     | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
+index 8f777d6441a5..80347382a380 100644
+--- a/arch/arc/include/asm/io.h
++++ b/arch/arc/include/asm/io.h
+@@ -32,7 +32,7 @@ static inline void ioport_unmap(void __iomem *addr)
+ {
+ }
+-extern void iounmap(const void __iomem *addr);
++extern void iounmap(const volatile void __iomem *addr);
+ /*
+  * io{read,write}{16,32}be() macros
+diff --git a/arch/arc/mm/ioremap.c b/arch/arc/mm/ioremap.c
+index 0ee75aca6e10..712c2311daef 100644
+--- a/arch/arc/mm/ioremap.c
++++ b/arch/arc/mm/ioremap.c
+@@ -94,7 +94,7 @@ void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
+ EXPORT_SYMBOL(ioremap_prot);
+-void iounmap(const void __iomem *addr)
++void iounmap(const volatile void __iomem *addr)
+ {
+       /* weird double cast to handle phys_addr_t > 32 bits */
+       if (arc_uncached_addr_space((phys_addr_t)(u32)addr))
+-- 
+2.35.1
+
diff --git a/queue-5.15/arm64-add-ampere1-to-the-spectre-bhb-affected-list.patch b/queue-5.15/arm64-add-ampere1-to-the-spectre-bhb-affected-list.patch
new file mode 100644 (file)
index 0000000..686a977
--- /dev/null
@@ -0,0 +1,80 @@
+From e1817806e57be4fc0f496ccf3f5642936f75e45d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Oct 2022 19:21:40 -0700
+Subject: arm64: Add AMPERE1 to the Spectre-BHB affected list
+
+From: D Scott Phillips <scott@os.amperecomputing.com>
+
+[ Upstream commit 0e5d5ae837c8ce04d2ddb874ec5f920118bd9d31 ]
+
+Per AmpereOne erratum AC03_CPU_12, "Branch history may allow control of
+speculative execution across software contexts," the AMPERE1 core needs the
+bhb clearing loop to mitigate Spectre-BHB, with a loop iteration count of
+11.
+
+Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
+Link: https://lore.kernel.org/r/20221011022140.432370-1-scott@os.amperecomputing.com
+Reviewed-by: James Morse <james.morse@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/include/asm/cputype.h | 4 ++++
+ arch/arm64/kernel/proton-pack.c  | 6 ++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
+index 39f5c1672f48..457b6bb276bb 100644
+--- a/arch/arm64/include/asm/cputype.h
++++ b/arch/arm64/include/asm/cputype.h
+@@ -60,6 +60,7 @@
+ #define ARM_CPU_IMP_FUJITSU           0x46
+ #define ARM_CPU_IMP_HISI              0x48
+ #define ARM_CPU_IMP_APPLE             0x61
++#define ARM_CPU_IMP_AMPERE            0xC0
+ #define ARM_CPU_PART_AEM_V8           0xD0F
+ #define ARM_CPU_PART_FOUNDATION               0xD00
+@@ -112,6 +113,8 @@
+ #define APPLE_CPU_PART_M1_ICESTORM    0x022
+ #define APPLE_CPU_PART_M1_FIRESTORM   0x023
++#define AMPERE_CPU_PART_AMPERE1               0xAC3
++
+ #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
+ #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
+ #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
+@@ -151,6 +154,7 @@
+ #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
+ #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM)
+ #define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM)
++#define MIDR_AMPERE1 MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1)
+ /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */
+ #define MIDR_FUJITSU_ERRATUM_010001           MIDR_FUJITSU_A64FX
+diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
+index 40be3a7c2c53..428cfabd11c4 100644
+--- a/arch/arm64/kernel/proton-pack.c
++++ b/arch/arm64/kernel/proton-pack.c
+@@ -868,6 +868,10 @@ u8 spectre_bhb_loop_affected(int scope)
+                       MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1),
+                       {},
+               };
++              static const struct midr_range spectre_bhb_k11_list[] = {
++                      MIDR_ALL_VERSIONS(MIDR_AMPERE1),
++                      {},
++              };
+               static const struct midr_range spectre_bhb_k8_list[] = {
+                       MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
+                       MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
+@@ -878,6 +882,8 @@ u8 spectre_bhb_loop_affected(int scope)
+                       k = 32;
+               else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k24_list))
+                       k = 24;
++              else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k11_list))
++                      k = 11;
+               else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list))
+                       k =  8;
+-- 
+2.35.1
+
diff --git a/queue-5.15/asoc-qcom-lpass-cpu-mark-hdmi-tx-parity-register-as-.patch b/queue-5.15/asoc-qcom-lpass-cpu-mark-hdmi-tx-parity-register-as-.patch
new file mode 100644 (file)
index 0000000..7359002
--- /dev/null
@@ -0,0 +1,39 @@
+From 4d3fd5bd7fd0dac1b865956c693b09da58e4938a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 15 Oct 2022 14:48:50 +0530
+Subject: ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile
+
+From: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
+
+[ Upstream commit 1dd5166102e7ca91e8c5d833110333835e147ddb ]
+
+Update LPASS_HDMI_TX_PARITY_ADDR register as volatile, to fix
+dp audio failures observed with some of external monitors.
+
+Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")
+
+Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
+Reviewed-by: Stephen Boyd <swboyd@chromium.org>
+Link: https://lore.kernel.org/r/1665825530-7593-1-git-send-email-quic_srivasam@quicinc.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/qcom/lpass-cpu.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
+index b37f4736ee10..5e8d045c1a06 100644
+--- a/sound/soc/qcom/lpass-cpu.c
++++ b/sound/soc/qcom/lpass-cpu.c
+@@ -781,6 +781,8 @@ static bool lpass_hdmi_regmap_volatile(struct device *dev, unsigned int reg)
+               return true;
+       if (reg == LPASS_HDMI_TX_VBIT_CTL_ADDR(v))
+               return true;
++      if (reg == LPASS_HDMI_TX_PARITY_ADDR(v))
++              return true;
+       for (i = 0; i < v->hdmi_rdma_channels; ++i) {
+               if (reg == LPAIF_HDMI_RDMACURR_REG(v, i))
+-- 
+2.35.1
+
diff --git a/queue-5.15/asoc-qcom-lpass-cpu-mark-hdmi-tx-registers-as-volati.patch b/queue-5.15/asoc-qcom-lpass-cpu-mark-hdmi-tx-registers-as-volati.patch
new file mode 100644 (file)
index 0000000..2933c09
--- /dev/null
@@ -0,0 +1,57 @@
+From 9f8a9be7a4449976b8110fa1109ce44527810914 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Oct 2022 10:38:31 +0530
+Subject: ASoC: qcom: lpass-cpu: mark HDMI TX registers as volatile
+
+From: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
+
+[ Upstream commit c9a3545b1d771fb7b06a487796c40288c02c41c5 ]
+
+Update HDMI volatile registers list as DMA, Channel Selection registers,
+vbit control registers are being reflected by hardware DP port
+disconnection.
+
+This update is required to fix no display and no sound issue observed
+after reconnecting TAMA/SANWA DP cables.
+Once DP cable is unplugged, DMA control registers are being reset by
+hardware, however at second plugin, new dma control values does not
+updated to the dma hardware registers since new register value and
+cached values at the time of first plugin are same.
+
+Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")
+
+Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
+Reported-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
+Link: https://lore.kernel.org/r/1665637711-13300-1-git-send-email-quic_srivasam@quicinc.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/qcom/lpass-cpu.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
+index 5e89d280e355..b37f4736ee10 100644
+--- a/sound/soc/qcom/lpass-cpu.c
++++ b/sound/soc/qcom/lpass-cpu.c
+@@ -779,10 +779,18 @@ static bool lpass_hdmi_regmap_volatile(struct device *dev, unsigned int reg)
+               return true;
+       if (reg == LPASS_HDMI_TX_LEGACY_ADDR(v))
+               return true;
++      if (reg == LPASS_HDMI_TX_VBIT_CTL_ADDR(v))
++              return true;
+       for (i = 0; i < v->hdmi_rdma_channels; ++i) {
+               if (reg == LPAIF_HDMI_RDMACURR_REG(v, i))
+                       return true;
++              if (reg == LPASS_HDMI_TX_DMA_ADDR(v, i))
++                      return true;
++              if (reg == LPASS_HDMI_TX_CH_LSB_ADDR(v, i))
++                      return true;
++              if (reg == LPASS_HDMI_TX_CH_MSB_ADDR(v, i))
++                      return true;
+       }
+       return false;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/atlantic-fix-deadlock-at-aq_nic_stop.patch b/queue-5.15/atlantic-fix-deadlock-at-aq_nic_stop.patch
new file mode 100644 (file)
index 0000000..137eb43
--- /dev/null
@@ -0,0 +1,250 @@
+From 796d9110a72ca2a24c0cfb9c337f2891107c25c4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 09:53:10 +0200
+Subject: atlantic: fix deadlock at aq_nic_stop
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Íñigo Huguet <ihuguet@redhat.com>
+
+[ Upstream commit 6960d133f66ecddcd3af2b1cbd0c7dcd104268b8 ]
+
+NIC is stopped with rtnl_lock held, and during the stop it cancels the
+'service_task' work and free irqs.
+
+However, if CONFIG_MACSEC is set, rtnl_lock is acquired both from
+aq_nic_service_task and aq_linkstate_threaded_isr. Then a deadlock
+happens if aq_nic_stop tries to cancel/disable them when they've already
+started their execution.
+
+As the deadlock is caused by rtnl_lock, it causes many other processes
+to stall, not only atlantic related stuff.
+
+Fix it by introducing a mutex that protects each NIC's macsec related
+data, and locking it instead of the rtnl_lock from the service task and
+the threaded IRQ.
+
+Before this patch, all macsec data was protected with rtnl_lock, but
+maybe not all of it needs to be protected. With this new mutex, further
+efforts can be made to limit the protected data only to that which
+requires it. However, probably it doesn't worth it because all macsec's
+data accesses are infrequent, and almost all are done from macsec_ops
+or ethtool callbacks, called holding rtnl_lock, so macsec_mutex won't
+never be much contended.
+
+The issue appeared repeteadly attaching and deattaching the NIC to a
+bond interface. Doing that after this patch I cannot reproduce the bug.
+
+Fixes: 62c1c2e606f6 ("net: atlantic: MACSec offload skeleton")
+Reported-by: Li Liang <liali@redhat.com>
+Suggested-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
+Reviewed-by: Igor Russkikh <irusskikh@marvell.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../ethernet/aquantia/atlantic/aq_macsec.c    | 96 ++++++++++++++-----
+ .../net/ethernet/aquantia/atlantic/aq_nic.h   |  2 +
+ 2 files changed, 74 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+index 4a6dfac857ca..7c6e0811f2e6 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+@@ -1451,26 +1451,57 @@ static void aq_check_txsa_expiration(struct aq_nic_s *nic)
+                       egress_sa_threshold_expired);
+ }
++#define AQ_LOCKED_MDO_DEF(mdo)                                                \
++static int aq_locked_mdo_##mdo(struct macsec_context *ctx)            \
++{                                                                     \
++      struct aq_nic_s *nic = netdev_priv(ctx->netdev);                \
++      int ret;                                                        \
++      mutex_lock(&nic->macsec_mutex);                                 \
++      ret = aq_mdo_##mdo(ctx);                                        \
++      mutex_unlock(&nic->macsec_mutex);                               \
++      return ret;                                                     \
++}
++
++AQ_LOCKED_MDO_DEF(dev_open)
++AQ_LOCKED_MDO_DEF(dev_stop)
++AQ_LOCKED_MDO_DEF(add_secy)
++AQ_LOCKED_MDO_DEF(upd_secy)
++AQ_LOCKED_MDO_DEF(del_secy)
++AQ_LOCKED_MDO_DEF(add_rxsc)
++AQ_LOCKED_MDO_DEF(upd_rxsc)
++AQ_LOCKED_MDO_DEF(del_rxsc)
++AQ_LOCKED_MDO_DEF(add_rxsa)
++AQ_LOCKED_MDO_DEF(upd_rxsa)
++AQ_LOCKED_MDO_DEF(del_rxsa)
++AQ_LOCKED_MDO_DEF(add_txsa)
++AQ_LOCKED_MDO_DEF(upd_txsa)
++AQ_LOCKED_MDO_DEF(del_txsa)
++AQ_LOCKED_MDO_DEF(get_dev_stats)
++AQ_LOCKED_MDO_DEF(get_tx_sc_stats)
++AQ_LOCKED_MDO_DEF(get_tx_sa_stats)
++AQ_LOCKED_MDO_DEF(get_rx_sc_stats)
++AQ_LOCKED_MDO_DEF(get_rx_sa_stats)
++
+ const struct macsec_ops aq_macsec_ops = {
+-      .mdo_dev_open = aq_mdo_dev_open,
+-      .mdo_dev_stop = aq_mdo_dev_stop,
+-      .mdo_add_secy = aq_mdo_add_secy,
+-      .mdo_upd_secy = aq_mdo_upd_secy,
+-      .mdo_del_secy = aq_mdo_del_secy,
+-      .mdo_add_rxsc = aq_mdo_add_rxsc,
+-      .mdo_upd_rxsc = aq_mdo_upd_rxsc,
+-      .mdo_del_rxsc = aq_mdo_del_rxsc,
+-      .mdo_add_rxsa = aq_mdo_add_rxsa,
+-      .mdo_upd_rxsa = aq_mdo_upd_rxsa,
+-      .mdo_del_rxsa = aq_mdo_del_rxsa,
+-      .mdo_add_txsa = aq_mdo_add_txsa,
+-      .mdo_upd_txsa = aq_mdo_upd_txsa,
+-      .mdo_del_txsa = aq_mdo_del_txsa,
+-      .mdo_get_dev_stats = aq_mdo_get_dev_stats,
+-      .mdo_get_tx_sc_stats = aq_mdo_get_tx_sc_stats,
+-      .mdo_get_tx_sa_stats = aq_mdo_get_tx_sa_stats,
+-      .mdo_get_rx_sc_stats = aq_mdo_get_rx_sc_stats,
+-      .mdo_get_rx_sa_stats = aq_mdo_get_rx_sa_stats,
++      .mdo_dev_open = aq_locked_mdo_dev_open,
++      .mdo_dev_stop = aq_locked_mdo_dev_stop,
++      .mdo_add_secy = aq_locked_mdo_add_secy,
++      .mdo_upd_secy = aq_locked_mdo_upd_secy,
++      .mdo_del_secy = aq_locked_mdo_del_secy,
++      .mdo_add_rxsc = aq_locked_mdo_add_rxsc,
++      .mdo_upd_rxsc = aq_locked_mdo_upd_rxsc,
++      .mdo_del_rxsc = aq_locked_mdo_del_rxsc,
++      .mdo_add_rxsa = aq_locked_mdo_add_rxsa,
++      .mdo_upd_rxsa = aq_locked_mdo_upd_rxsa,
++      .mdo_del_rxsa = aq_locked_mdo_del_rxsa,
++      .mdo_add_txsa = aq_locked_mdo_add_txsa,
++      .mdo_upd_txsa = aq_locked_mdo_upd_txsa,
++      .mdo_del_txsa = aq_locked_mdo_del_txsa,
++      .mdo_get_dev_stats = aq_locked_mdo_get_dev_stats,
++      .mdo_get_tx_sc_stats = aq_locked_mdo_get_tx_sc_stats,
++      .mdo_get_tx_sa_stats = aq_locked_mdo_get_tx_sa_stats,
++      .mdo_get_rx_sc_stats = aq_locked_mdo_get_rx_sc_stats,
++      .mdo_get_rx_sa_stats = aq_locked_mdo_get_rx_sa_stats,
+ };
+ int aq_macsec_init(struct aq_nic_s *nic)
+@@ -1492,6 +1523,7 @@ int aq_macsec_init(struct aq_nic_s *nic)
+       nic->ndev->features |= NETIF_F_HW_MACSEC;
+       nic->ndev->macsec_ops = &aq_macsec_ops;
++      mutex_init(&nic->macsec_mutex);
+       return 0;
+ }
+@@ -1515,7 +1547,7 @@ int aq_macsec_enable(struct aq_nic_s *nic)
+       if (!nic->macsec_cfg)
+               return 0;
+-      rtnl_lock();
++      mutex_lock(&nic->macsec_mutex);
+       if (nic->aq_fw_ops->send_macsec_req) {
+               struct macsec_cfg_request cfg = { 0 };
+@@ -1564,7 +1596,7 @@ int aq_macsec_enable(struct aq_nic_s *nic)
+       ret = aq_apply_macsec_cfg(nic);
+ unlock:
+-      rtnl_unlock();
++      mutex_unlock(&nic->macsec_mutex);
+       return ret;
+ }
+@@ -1576,9 +1608,9 @@ void aq_macsec_work(struct aq_nic_s *nic)
+       if (!netif_carrier_ok(nic->ndev))
+               return;
+-      rtnl_lock();
++      mutex_lock(&nic->macsec_mutex);
+       aq_check_txsa_expiration(nic);
+-      rtnl_unlock();
++      mutex_unlock(&nic->macsec_mutex);
+ }
+ int aq_macsec_rx_sa_cnt(struct aq_nic_s *nic)
+@@ -1589,21 +1621,30 @@ int aq_macsec_rx_sa_cnt(struct aq_nic_s *nic)
+       if (!cfg)
+               return 0;
++      mutex_lock(&nic->macsec_mutex);
++
+       for (i = 0; i < AQ_MACSEC_MAX_SC; i++) {
+               if (!test_bit(i, &cfg->rxsc_idx_busy))
+                       continue;
+               cnt += hweight_long(cfg->aq_rxsc[i].rx_sa_idx_busy);
+       }
++      mutex_unlock(&nic->macsec_mutex);
+       return cnt;
+ }
+ int aq_macsec_tx_sc_cnt(struct aq_nic_s *nic)
+ {
++      int cnt;
++
+       if (!nic->macsec_cfg)
+               return 0;
+-      return hweight_long(nic->macsec_cfg->txsc_idx_busy);
++      mutex_lock(&nic->macsec_mutex);
++      cnt = hweight_long(nic->macsec_cfg->txsc_idx_busy);
++      mutex_unlock(&nic->macsec_mutex);
++
++      return cnt;
+ }
+ int aq_macsec_tx_sa_cnt(struct aq_nic_s *nic)
+@@ -1614,12 +1655,15 @@ int aq_macsec_tx_sa_cnt(struct aq_nic_s *nic)
+       if (!cfg)
+               return 0;
++      mutex_lock(&nic->macsec_mutex);
++
+       for (i = 0; i < AQ_MACSEC_MAX_SC; i++) {
+               if (!test_bit(i, &cfg->txsc_idx_busy))
+                       continue;
+               cnt += hweight_long(cfg->aq_txsc[i].tx_sa_idx_busy);
+       }
++      mutex_unlock(&nic->macsec_mutex);
+       return cnt;
+ }
+@@ -1691,6 +1735,8 @@ u64 *aq_macsec_get_stats(struct aq_nic_s *nic, u64 *data)
+       if (!cfg)
+               return data;
++      mutex_lock(&nic->macsec_mutex);
++
+       aq_macsec_update_stats(nic);
+       common_stats = &cfg->stats;
+@@ -1773,5 +1819,7 @@ u64 *aq_macsec_get_stats(struct aq_nic_s *nic, u64 *data)
+       data += i;
++      mutex_unlock(&nic->macsec_mutex);
++
+       return data;
+ }
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+index 1a7148041e3d..b7f7d6f66633 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+@@ -154,6 +154,8 @@ struct aq_nic_s {
+       struct mutex fwreq_mutex;
+ #if IS_ENABLED(CONFIG_MACSEC)
+       struct aq_macsec_cfg *macsec_cfg;
++      /* mutex to protect data in macsec_cfg */
++      struct mutex macsec_mutex;
+ #endif
+       /* PTP support */
+       struct aq_ptp_s *aq_ptp;
+-- 
+2.35.1
+
diff --git a/queue-5.15/can-mcp251x-mcp251x_can_probe-add-missing-unregister.patch b/queue-5.15/can-mcp251x-mcp251x_can_probe-add-missing-unregister.patch
new file mode 100644 (file)
index 0000000..4c8ed09
--- /dev/null
@@ -0,0 +1,48 @@
+From f002ef6a1db70a03cdc20458721eee5d20071bab Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 17:02:52 +0800
+Subject: can: mcp251x: mcp251x_can_probe(): add missing unregister_candev() in
+ error path
+
+From: Dongliang Mu <dzm91@hust.edu.cn>
+
+[ Upstream commit b1a09b63684cea56774786ca14c13b7041ffee63 ]
+
+In mcp251x_can_probe(), if mcp251x_gpio_setup() fails, it forgets to
+unregister the CAN device.
+
+Fix this by unregistering can device in mcp251x_can_probe().
+
+Fixes: 2d52dabbef60 ("can: mcp251x: add GPIO support")
+Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
+Link: https://lore.kernel.org/all/20221024090256.717236-1-dzm91@hust.edu.cn
+[mkl: adjust label]
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/can/spi/mcp251x.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
+index baab3adc34bc..f02275f71e4d 100644
+--- a/drivers/net/can/spi/mcp251x.c
++++ b/drivers/net/can/spi/mcp251x.c
+@@ -1419,11 +1419,14 @@ static int mcp251x_can_probe(struct spi_device *spi)
+       ret = mcp251x_gpio_setup(priv);
+       if (ret)
+-              goto error_probe;
++              goto out_unregister_candev;
+       netdev_info(net, "MCP%x successfully initialized.\n", priv->model);
+       return 0;
++out_unregister_candev:
++      unregister_candev(net);
++
+ error_probe:
+       destroy_workqueue(priv->wq);
+       priv->wq = NULL;
+-- 
+2.35.1
+
diff --git a/queue-5.15/can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch b/queue-5.15/can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch
new file mode 100644 (file)
index 0000000..408c21f
--- /dev/null
@@ -0,0 +1,60 @@
+From 4f9a1a1ea28bbc7f28b0a4c6b025eff282351453 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 19:48:07 +0800
+Subject: can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in
+ error path
+
+From: Dongliang Mu <dzm91@hust.edu.cn>
+
+[ Upstream commit 3e5b3418827cefb5e1cc658806f02965791b8f07 ]
+
+The commit 1149108e2fbf ("can: mscan: improve clock API use") only
+adds put_clock() in mpc5xxx_can_remove() function, forgetting to add
+put_clock() in the error handling code.
+
+Fix this bug by adding put_clock() in the error handling code.
+
+Fixes: 1149108e2fbf ("can: mscan: improve clock API use")
+Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
+Link: https://lore.kernel.org/all/20221024133828.35881-1-mkl@pengutronix.de
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/can/mscan/mpc5xxx_can.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
+index 35892c1efef0..7d868b6eb579 100644
+--- a/drivers/net/can/mscan/mpc5xxx_can.c
++++ b/drivers/net/can/mscan/mpc5xxx_can.c
+@@ -322,14 +322,14 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
+                                              &mscan_clksrc);
+       if (!priv->can.clock.freq) {
+               dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n");
+-              goto exit_free_mscan;
++              goto exit_put_clock;
+       }
+       err = register_mscandev(dev, mscan_clksrc);
+       if (err) {
+               dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
+                       DRV_NAME, err);
+-              goto exit_free_mscan;
++              goto exit_put_clock;
+       }
+       dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
+@@ -337,7 +337,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
+       return 0;
+-exit_free_mscan:
++exit_put_clock:
++      if (data->put_clock)
++              data->put_clock(ofdev);
+       free_candev(dev);
+ exit_dispose_irq:
+       irq_dispose_mapping(irq);
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-amdkfd-fix-memory-leak-in-kfd_mem_dmamap_userptr.patch b/queue-5.15/drm-amdkfd-fix-memory-leak-in-kfd_mem_dmamap_userptr.patch
new file mode 100644 (file)
index 0000000..4146948
--- /dev/null
@@ -0,0 +1,48 @@
+From 6b007f2b7ec4efcbcf423fd6b61e1b9e5f4c090c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Oct 2022 22:27:50 -0300
+Subject: drm/amdkfd: Fix memory leak in kfd_mem_dmamap_userptr()
+
+From: Rafael Mendonca <rafaelmendsr@gmail.com>
+
+[ Upstream commit 90bfee142af0f0e9d3bec80e7acd5f49b230acf7 ]
+
+If the number of pages from the userptr BO differs from the SG BO then the
+allocated memory for the SG table doesn't get freed before returning
+-EINVAL, which may lead to a memory leak in some error paths. Fix this by
+checking the number of pages before allocating memory for the SG table.
+
+Fixes: 264fb4d332f5 ("drm/amdgpu: Add multi-GPU DMA mapping helpers")
+Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
+Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index c904269b3e14..477ab3551177 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -476,13 +476,13 @@ kfd_mem_dmamap_userptr(struct kgd_mem *mem,
+       struct ttm_tt *ttm = bo->tbo.ttm;
+       int ret;
++      if (WARN_ON(ttm->num_pages != src_ttm->num_pages))
++              return -EINVAL;
++
+       ttm->sg = kmalloc(sizeof(*ttm->sg), GFP_KERNEL);
+       if (unlikely(!ttm->sg))
+               return -ENOMEM;
+-      if (WARN_ON(ttm->num_pages != src_ttm->num_pages))
+-              return -EINVAL;
+-
+       /* Same sequence as in amdgpu_ttm_tt_pin_userptr */
+       ret = sg_alloc_table_from_pages(ttm->sg, src_ttm->pages,
+                                       ttm->num_pages, 0,
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-i915-dp-reset-frl-trained-flag-before-restarting.patch b/queue-5.15/drm-i915-dp-reset-frl-trained-flag-before-restarting.patch
new file mode 100644 (file)
index 0000000..d4a14b2
--- /dev/null
@@ -0,0 +1,47 @@
+From d5b44a85191830d38caf5d234cf1063af12e348e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Oct 2022 12:04:40 +0530
+Subject: drm/i915/dp: Reset frl trained flag before restarting FRL training
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
+
+[ Upstream commit 63720a561b3c98199adf0c73e152807f15cc3b7f ]
+
+For cases where DP has HDMI2.1 sink and FRL Link issues are detected,
+reset the flag to state FRL trained status before restarting FRL
+training.
+
+Fixes: 9488a030ac91 ("drm/i915: Add support for enabling link status and recovery")
+Cc: Swati Sharma <swati2.sharma@intel.com>
+Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
+Cc: Uma Shankar <uma.shankar@intel.com> (v2)
+Cc: Jani Nikula <jani.nikula@intel.com>
+Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
+Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20221011063447.904649-2-ankit.k.nautiyal@intel.com
+(cherry picked from commit 47e1a59e60c688c5f95b67277202f05b7e84c189)
+Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/i915/display/intel_dp.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
+index f87e4d510ea5..1ccdf2da042b 100644
+--- a/drivers/gpu/drm/i915/display/intel_dp.c
++++ b/drivers/gpu/drm/i915/display/intel_dp.c
+@@ -3497,6 +3497,8 @@ intel_dp_handle_hdmi_link_status_change(struct intel_dp *intel_dp)
+               drm_dp_pcon_hdmi_frl_link_error_count(&intel_dp->aux, &intel_dp->attached_connector->base);
++              intel_dp->frl.is_trained = false;
++
+               /* Restart FRL training or fall back to TMDS mode */
+               intel_dp_check_frl_training(intel_dp);
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch b/queue-5.15/drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch
new file mode 100644 (file)
index 0000000..c94651a
--- /dev/null
@@ -0,0 +1,54 @@
+From a4460201779056b3911236a87aca90438443ee1a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Sep 2022 13:55:48 -0700
+Subject: drm/msm: Fix return type of mdp4_lvds_connector_mode_valid
+
+From: Nathan Huckleberry <nhuck@google.com>
+
+[ Upstream commit 0b33a33bd15d5bab73b87152b220a8d0153a4587 ]
+
+The mode_valid field in drm_connector_helper_funcs is expected to be of
+type:
+enum drm_mode_status (* mode_valid) (struct drm_connector *connector,
+                                     struct drm_display_mode *mode);
+
+The mismatched return type breaks forward edge kCFI since the underlying
+function definition does not match the function hook definition.
+
+The return type of mdp4_lvds_connector_mode_valid should be changed from
+int to enum drm_mode_status.
+
+Reported-by: Dan Carpenter <error27@gmail.com>
+Link: https://github.com/ClangBuiltLinux/linux/issues/1703
+Cc: llvm@lists.linux.dev
+Signed-off-by: Nathan Huckleberry <nhuck@google.com>
+Fixes: 3e87599b68e7 ("drm/msm/mdp4: add LVDS panel support")
+Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Patchwork: https://patchwork.freedesktop.org/patch/502878/
+Link: https://lore.kernel.org/r/20220913205551.155128-1-nhuck@google.com
+Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
+index 7288041dd86a..7444b75c4215 100644
+--- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
++++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c
+@@ -56,8 +56,9 @@ static int mdp4_lvds_connector_get_modes(struct drm_connector *connector)
+       return ret;
+ }
+-static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
+-                               struct drm_display_mode *mode)
++static enum drm_mode_status
++mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
++                             struct drm_display_mode *mode)
+ {
+       struct mdp4_lvds_connector *mdp4_lvds_connector =
+                       to_mdp4_lvds_connector(connector);
+-- 
+2.35.1
+
diff --git a/queue-5.15/i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch b/queue-5.15/i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch
new file mode 100644 (file)
index 0000000..0ea77e9
--- /dev/null
@@ -0,0 +1,129 @@
+From e7ec13558245ab2df636c3d73fa9fafe46ca833f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 03:05:24 -0700
+Subject: i40e: Fix ethtool rx-flow-hash setting for X722
+
+From: Slawomir Laba <slawomirx.laba@intel.com>
+
+[ Upstream commit 54b5af5a438076082d482cab105b1bd484ab5074 ]
+
+When enabling flow type for RSS hash via ethtool:
+
+ethtool -N $pf rx-flow-hash tcp4|tcp6|udp4|udp6 s|d
+
+the driver would fail to setup this setting on X722
+device since it was using the mask on the register
+dedicated for X710 devices.
+
+Apply a different mask on the register when setting the
+RSS hash for the X722 device.
+
+When displaying the flow types enabled via ethtool:
+
+ethtool -n $pf rx-flow-hash tcp4|tcp6|udp4|udp6
+
+the driver would print wrong values for X722 device.
+
+Fix this issue by testing masks for X722 device in
+i40e_get_rss_hash_opts function.
+
+Fixes: eb0dd6e4a3b3 ("i40e: Allow RSS Hash set with less than four parameters")
+Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
+Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
+Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
+Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Link: https://lore.kernel.org/r/20221024100526.1874914-1-jacob.e.keller@intel.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/intel/i40e/i40e_ethtool.c    | 31 ++++++++++++++-----
+ drivers/net/ethernet/intel/i40e/i40e_type.h   |  4 +++
+ 2 files changed, 27 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+index 11a17ebfceef..6d94255bea5f 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+@@ -3085,10 +3085,17 @@ static int i40e_get_rss_hash_opts(struct i40e_pf *pf, struct ethtool_rxnfc *cmd)
+               if (cmd->flow_type == TCP_V4_FLOW ||
+                   cmd->flow_type == UDP_V4_FLOW) {
+-                      if (i_set & I40E_L3_SRC_MASK)
+-                              cmd->data |= RXH_IP_SRC;
+-                      if (i_set & I40E_L3_DST_MASK)
+-                              cmd->data |= RXH_IP_DST;
++                      if (hw->mac.type == I40E_MAC_X722) {
++                              if (i_set & I40E_X722_L3_SRC_MASK)
++                                      cmd->data |= RXH_IP_SRC;
++                              if (i_set & I40E_X722_L3_DST_MASK)
++                                      cmd->data |= RXH_IP_DST;
++                      } else {
++                              if (i_set & I40E_L3_SRC_MASK)
++                                      cmd->data |= RXH_IP_SRC;
++                              if (i_set & I40E_L3_DST_MASK)
++                                      cmd->data |= RXH_IP_DST;
++                      }
+               } else if (cmd->flow_type == TCP_V6_FLOW ||
+                         cmd->flow_type == UDP_V6_FLOW) {
+                       if (i_set & I40E_L3_V6_SRC_MASK)
+@@ -3446,12 +3453,15 @@ static int i40e_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
+ /**
+  * i40e_get_rss_hash_bits - Read RSS Hash bits from register
++ * @hw: hw structure
+  * @nfc: pointer to user request
+  * @i_setc: bits currently set
+  *
+  * Returns value of bits to be set per user request
+  **/
+-static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc *nfc, u64 i_setc)
++static u64 i40e_get_rss_hash_bits(struct i40e_hw *hw,
++                                struct ethtool_rxnfc *nfc,
++                                u64 i_setc)
+ {
+       u64 i_set = i_setc;
+       u64 src_l3 = 0, dst_l3 = 0;
+@@ -3470,8 +3480,13 @@ static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc *nfc, u64 i_setc)
+               dst_l3 = I40E_L3_V6_DST_MASK;
+       } else if (nfc->flow_type == TCP_V4_FLOW ||
+                 nfc->flow_type == UDP_V4_FLOW) {
+-              src_l3 = I40E_L3_SRC_MASK;
+-              dst_l3 = I40E_L3_DST_MASK;
++              if (hw->mac.type == I40E_MAC_X722) {
++                      src_l3 = I40E_X722_L3_SRC_MASK;
++                      dst_l3 = I40E_X722_L3_DST_MASK;
++              } else {
++                      src_l3 = I40E_L3_SRC_MASK;
++                      dst_l3 = I40E_L3_DST_MASK;
++              }
+       } else {
+               /* Any other flow type are not supported here */
+               return i_set;
+@@ -3586,7 +3601,7 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
+                                              flow_pctype)) |
+                       ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1,
+                                              flow_pctype)) << 32);
+-              i_set = i40e_get_rss_hash_bits(nfc, i_setc);
++              i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
+               i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_pctype),
+                                 (u32)i_set);
+               i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_pctype),
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
+index 7b3f30beb757..388c3d36d96a 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
+@@ -1404,6 +1404,10 @@ struct i40e_lldp_variables {
+ #define I40E_PFQF_CTL_0_HASHLUTSIZE_512       0x00010000
+ /* INPUT SET MASK for RSS, flow director, and flexible payload */
++#define I40E_X722_L3_SRC_SHIFT                49
++#define I40E_X722_L3_SRC_MASK         (0x3ULL << I40E_X722_L3_SRC_SHIFT)
++#define I40E_X722_L3_DST_SHIFT                41
++#define I40E_X722_L3_DST_MASK         (0x3ULL << I40E_X722_L3_DST_SHIFT)
+ #define I40E_L3_SRC_SHIFT             47
+ #define I40E_L3_SRC_MASK              (0x3ULL << I40E_L3_SRC_SHIFT)
+ #define I40E_L3_V6_SRC_SHIFT          43
+-- 
+2.35.1
+
diff --git a/queue-5.15/i40e-fix-flow-type-by-setting-gl_hash_inset-register.patch b/queue-5.15/i40e-fix-flow-type-by-setting-gl_hash_inset-register.patch
new file mode 100644 (file)
index 0000000..377ca03
--- /dev/null
@@ -0,0 +1,144 @@
+From 83bfd0668ebf92ecb8af971b6acf83e8879e9b45 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 03:05:26 -0700
+Subject: i40e: Fix flow-type by setting GL_HASH_INSET registers
+
+From: Slawomir Laba <slawomirx.laba@intel.com>
+
+[ Upstream commit 3b32c9932853e11d71f9db012d69e92e4669ba23 ]
+
+Fix setting bits for specific flow_type for GLQF_HASH_INSET register.
+In previous version all of the bits were set only in hena register, while
+in inset only one bit was set. In order for this working correctly on all
+types of cards these bits needs to be set correctly for both hena and inset
+registers.
+
+Fixes: eb0dd6e4a3b3 ("i40e: Allow RSS Hash set with less than four parameters")
+Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
+Signed-off-by: Michal Jaron <michalx.jaron@intel.com>
+Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Link: https://lore.kernel.org/r/20221024100526.1874914-3-jacob.e.keller@intel.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/intel/i40e/i40e_ethtool.c    | 71 ++++++++++---------
+ 1 file changed, 38 insertions(+), 33 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+index 6d94255bea5f..4e3243287805 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+@@ -3504,6 +3504,7 @@ static u64 i40e_get_rss_hash_bits(struct i40e_hw *hw,
+       return i_set;
+ }
++#define FLOW_PCTYPES_SIZE 64
+ /**
+  * i40e_set_rss_hash_opt - Enable/Disable flow types for RSS hash
+  * @pf: pointer to the physical function struct
+@@ -3516,9 +3517,11 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
+       struct i40e_hw *hw = &pf->hw;
+       u64 hena = (u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0)) |
+                  ((u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1)) << 32);
+-      u8 flow_pctype = 0;
++      DECLARE_BITMAP(flow_pctypes, FLOW_PCTYPES_SIZE);
+       u64 i_set, i_setc;
++      bitmap_zero(flow_pctypes, FLOW_PCTYPES_SIZE);
++
+       if (pf->flags & I40E_FLAG_MFP_ENABLED) {
+               dev_err(&pf->pdev->dev,
+                       "Change of RSS hash input set is not supported when MFP mode is enabled\n");
+@@ -3534,36 +3537,35 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
+       switch (nfc->flow_type) {
+       case TCP_V4_FLOW:
+-              flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
++              set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_TCP, flow_pctypes);
+               if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE)
+-                      hena |=
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
++                      set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK,
++                              flow_pctypes);
+               break;
+       case TCP_V6_FLOW:
+-              flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
+-              if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE)
+-                      hena |=
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK);
++              set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_TCP, flow_pctypes);
+               if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE)
+-                      hena |=
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK);
++                      set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK,
++                              flow_pctypes);
+               break;
+       case UDP_V4_FLOW:
+-              flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
+-              if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE)
+-                      hena |=
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) |
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP);
+-
++              set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_UDP, flow_pctypes);
++              if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) {
++                      set_bit(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP,
++                              flow_pctypes);
++                      set_bit(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP,
++                              flow_pctypes);
++              }
+               hena |= BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4);
+               break;
+       case UDP_V6_FLOW:
+-              flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
+-              if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE)
+-                      hena |=
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) |
+-                        BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP);
+-
++              set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_UDP, flow_pctypes);
++              if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) {
++                      set_bit(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP,
++                              flow_pctypes);
++                      set_bit(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP,
++                              flow_pctypes);
++              }
+               hena |= BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6);
+               break;
+       case AH_ESP_V4_FLOW:
+@@ -3596,17 +3598,20 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, struct ethtool_rxnfc *nfc)
+               return -EINVAL;
+       }
+-      if (flow_pctype) {
+-              i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0,
+-                                             flow_pctype)) |
+-                      ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1,
+-                                             flow_pctype)) << 32);
+-              i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
+-              i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_pctype),
+-                                (u32)i_set);
+-              i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_pctype),
+-                                (u32)(i_set >> 32));
+-              hena |= BIT_ULL(flow_pctype);
++      if (bitmap_weight(flow_pctypes, FLOW_PCTYPES_SIZE)) {
++              u8 flow_id;
++
++              for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) {
++                      i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id)) |
++                               ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id)) << 32);
++                      i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
++
++                      i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id),
++                                        (u32)i_set);
++                      i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id),
++                                        (u32)(i_set >> 32));
++                      hena |= BIT_ULL(flow_id);
++              }
+       }
+       i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (u32)hena);
+-- 
+2.35.1
+
diff --git a/queue-5.15/i40e-fix-vf-hang-when-reset-is-triggered-on-another-.patch b/queue-5.15/i40e-fix-vf-hang-when-reset-is-triggered-on-another-.patch
new file mode 100644 (file)
index 0000000..5e6806e
--- /dev/null
@@ -0,0 +1,150 @@
+From 419ea51be0e59efcdd6eb4f0869ccd27dd4f1092 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 03:05:25 -0700
+Subject: i40e: Fix VF hang when reset is triggered on another VF
+
+From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
+
+[ Upstream commit 52424f974bc53c26ba3f00300a00e9de9afcd972 ]
+
+When a reset was triggered on one VF with i40e_reset_vf
+global PF state __I40E_VF_DISABLE was set on a PF until
+the reset finished. If immediately after triggering reset
+on one VF there is a request to reset on another
+it will cause a hang on VF side because VF will be notified
+of incoming reset but the reset will never happen because
+of this global state, we will get such error message:
+
+[  +4.890195] iavf 0000:86:02.1: Never saw reset
+
+and VF will hang waiting for the reset to be triggered.
+
+Fix this by introducing new VF state I40E_VF_STATE_RESETTING
+that will be set on a VF if it is currently resetting instead of
+the global __I40E_VF_DISABLE PF state.
+
+Fixes: 3ba9bcb4b68f ("i40e: add locking around VF reset")
+Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
+Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
+Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Link: https://lore.kernel.org/r/20221024100526.1874914-2-jacob.e.keller@intel.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 43 ++++++++++++++-----
+ .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  1 +
+ 2 files changed, 33 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+index c078fbaf19fd..8f350792e823 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+@@ -1536,10 +1536,12 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
+       if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state))
+               return true;
+-      /* If the VFs have been disabled, this means something else is
+-       * resetting the VF, so we shouldn't continue.
+-       */
+-      if (test_and_set_bit(__I40E_VF_DISABLE, pf->state))
++      /* Bail out if VFs are disabled. */
++      if (test_bit(__I40E_VF_DISABLE, pf->state))
++              return true;
++
++      /* If VF is being reset already we don't need to continue. */
++      if (test_and_set_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
+               return true;
+       i40e_trigger_vf_reset(vf, flr);
+@@ -1576,7 +1578,7 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
+       i40e_cleanup_reset_vf(vf);
+       i40e_flush(hw);
+-      clear_bit(__I40E_VF_DISABLE, pf->state);
++      clear_bit(I40E_VF_STATE_RESETTING, &vf->vf_states);
+       return true;
+ }
+@@ -1609,8 +1611,12 @@ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr)
+               return false;
+       /* Begin reset on all VFs at once */
+-      for (v = 0; v < pf->num_alloc_vfs; v++)
+-              i40e_trigger_vf_reset(&pf->vf[v], flr);
++      for (v = 0; v < pf->num_alloc_vfs; v++) {
++              vf = &pf->vf[v];
++              /* If VF is being reset no need to trigger reset again */
++              if (!test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
++                      i40e_trigger_vf_reset(&pf->vf[v], flr);
++      }
+       /* HW requires some time to make sure it can flush the FIFO for a VF
+        * when it resets it. Poll the VPGEN_VFRSTAT register for each VF in
+@@ -1626,9 +1632,11 @@ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr)
+                */
+               while (v < pf->num_alloc_vfs) {
+                       vf = &pf->vf[v];
+-                      reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id));
+-                      if (!(reg & I40E_VPGEN_VFRSTAT_VFRD_MASK))
+-                              break;
++                      if (!test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) {
++                              reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id));
++                              if (!(reg & I40E_VPGEN_VFRSTAT_VFRD_MASK))
++                                      break;
++                      }
+                       /* If the current VF has finished resetting, move on
+                        * to the next VF in sequence.
+@@ -1656,6 +1664,10 @@ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr)
+               if (pf->vf[v].lan_vsi_idx == 0)
+                       continue;
++              /* If VF is reset in another thread just continue */
++              if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
++                      continue;
++
+               i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[v].lan_vsi_idx]);
+       }
+@@ -1667,6 +1679,10 @@ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr)
+               if (pf->vf[v].lan_vsi_idx == 0)
+                       continue;
++              /* If VF is reset in another thread just continue */
++              if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
++                      continue;
++
+               i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[v].lan_vsi_idx]);
+       }
+@@ -1676,8 +1692,13 @@ bool i40e_reset_all_vfs(struct i40e_pf *pf, bool flr)
+       mdelay(50);
+       /* Finish the reset on each VF */
+-      for (v = 0; v < pf->num_alloc_vfs; v++)
++      for (v = 0; v < pf->num_alloc_vfs; v++) {
++              /* If VF is reset in another thread just continue */
++              if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
++                      continue;
++
+               i40e_cleanup_reset_vf(&pf->vf[v]);
++      }
+       i40e_flush(hw);
+       clear_bit(__I40E_VF_DISABLE, pf->state);
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+index a554d0a0b09b..358bbdb58795 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+@@ -39,6 +39,7 @@ enum i40e_vf_states {
+       I40E_VF_STATE_MC_PROMISC,
+       I40E_VF_STATE_UC_PROMISC,
+       I40E_VF_STATE_PRE_ENABLE,
++      I40E_VF_STATE_RESETTING
+ };
+ /* VF capabilities */
+-- 
+2.35.1
+
diff --git a/queue-5.15/ipv6-ensure-sane-device-mtu-in-tunnels.patch b/queue-5.15/ipv6-ensure-sane-device-mtu-in-tunnels.patch
new file mode 100644 (file)
index 0000000..b60ee3a
--- /dev/null
@@ -0,0 +1,157 @@
+From acc957ca5afec2cec24697f24fb35cd67c312e67 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 23 Oct 2022 19:01:24 -0700
+Subject: ipv6: ensure sane device mtu in tunnels
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit d89d7ff01235f218dad37de84457717f699dee79 ]
+
+Another syzbot report [1] with no reproducer hints
+at a bug in ip6_gre tunnel (dev:ip6gretap0)
+
+Since ipv6 mcast code makes sure to read dev->mtu once
+and applies a sanity check on it (see commit b9b312a7a451
+"ipv6: mcast: better catch silly mtu values"), a remaining
+possibility is that a layer is able to set dev->mtu to
+an underflowed value (high order bit set).
+
+This could happen indeed in ip6gre_tnl_link_config_route(),
+ip6_tnl_link_config() and ipip6_tunnel_bind_dev()
+
+Make sure to sanitize mtu value in a local variable before
+it is written once on dev->mtu, as lockless readers could
+catch wrong temporary value.
+
+[1]
+skbuff: skb_over_panic: text:ffff80000b7a2f38 len:40 put:40 head:ffff000149dcf200 data:ffff000149dcf2b0 tail:0xd8 end:0xc0 dev:ip6gretap0
+------------[ cut here ]------------
+kernel BUG at net/core/skbuff.c:120
+Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
+Modules linked in:
+CPU: 1 PID: 10241 Comm: kworker/1:1 Not tainted 6.0.0-rc7-syzkaller-18095-gbbed346d5a96 #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
+Workqueue: mld mld_ifc_work
+pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
+pc : skb_panic+0x4c/0x50 net/core/skbuff.c:116
+lr : skb_panic+0x4c/0x50 net/core/skbuff.c:116
+sp : ffff800020dd3b60
+x29: ffff800020dd3b70 x28: 0000000000000000 x27: ffff00010df2a800
+x26: 00000000000000c0 x25: 00000000000000b0 x24: ffff000149dcf200
+x23: 00000000000000c0 x22: 00000000000000d8 x21: ffff80000b7a2f38
+x20: ffff00014c2f7800 x19: 0000000000000028 x18: 00000000000001a9
+x17: 0000000000000000 x16: ffff80000db49158 x15: ffff000113bf1a80
+x14: 0000000000000000 x13: 00000000ffffffff x12: ffff000113bf1a80
+x11: ff808000081c0d5c x10: 0000000000000000 x9 : 73f125dc5c63ba00
+x8 : 73f125dc5c63ba00 x7 : ffff800008161d1c x6 : 0000000000000000
+x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
+x2 : ffff0001fefddcd0 x1 : 0000000100000000 x0 : 0000000000000089
+Call trace:
+skb_panic+0x4c/0x50 net/core/skbuff.c:116
+skb_over_panic net/core/skbuff.c:125 [inline]
+skb_put+0xd4/0xdc net/core/skbuff.c:2049
+ip6_mc_hdr net/ipv6/mcast.c:1714 [inline]
+mld_newpack+0x14c/0x270 net/ipv6/mcast.c:1765
+add_grhead net/ipv6/mcast.c:1851 [inline]
+add_grec+0xa20/0xae0 net/ipv6/mcast.c:1989
+mld_send_cr+0x438/0x5a8 net/ipv6/mcast.c:2115
+mld_ifc_work+0x38/0x290 net/ipv6/mcast.c:2653
+process_one_work+0x2d8/0x504 kernel/workqueue.c:2289
+worker_thread+0x340/0x610 kernel/workqueue.c:2436
+kthread+0x12c/0x158 kernel/kthread.c:376
+ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
+Code: 91011400 aa0803e1 a90027ea 94373093 (d4210000)
+
+Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://lore.kernel.org/r/20221024020124.3756833-1-eric.dumazet@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/ip6_gre.c    | 12 +++++++-----
+ net/ipv6/ip6_tunnel.c | 11 ++++++-----
+ net/ipv6/sit.c        |  8 +++++---
+ 3 files changed, 18 insertions(+), 13 deletions(-)
+
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
+index 70ef4d4ebff4..13b1748b8b46 100644
+--- a/net/ipv6/ip6_gre.c
++++ b/net/ipv6/ip6_gre.c
+@@ -1153,14 +1153,16 @@ static void ip6gre_tnl_link_config_route(struct ip6_tnl *t, int set_mtu,
+                               dev->needed_headroom = dst_len;
+                       if (set_mtu) {
+-                              dev->mtu = rt->dst.dev->mtu - t_hlen;
++                              int mtu = rt->dst.dev->mtu - t_hlen;
++
+                               if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
+-                                      dev->mtu -= 8;
++                                      mtu -= 8;
+                               if (dev->type == ARPHRD_ETHER)
+-                                      dev->mtu -= ETH_HLEN;
++                                      mtu -= ETH_HLEN;
+-                              if (dev->mtu < IPV6_MIN_MTU)
+-                                      dev->mtu = IPV6_MIN_MTU;
++                              if (mtu < IPV6_MIN_MTU)
++                                      mtu = IPV6_MIN_MTU;
++                              WRITE_ONCE(dev->mtu, mtu);
+                       }
+               }
+               ip6_rt_put(rt);
+diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
+index fa8da8ff35b4..ea5077942871 100644
+--- a/net/ipv6/ip6_tunnel.c
++++ b/net/ipv6/ip6_tunnel.c
+@@ -1446,8 +1446,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
+       struct net_device *tdev = NULL;
+       struct __ip6_tnl_parm *p = &t->parms;
+       struct flowi6 *fl6 = &t->fl.u.ip6;
+-      unsigned int mtu;
+       int t_hlen;
++      int mtu;
+       memcpy(dev->dev_addr, &p->laddr, sizeof(struct in6_addr));
+       memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr));
+@@ -1494,12 +1494,13 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
+                       dev->hard_header_len = tdev->hard_header_len + t_hlen;
+                       mtu = min_t(unsigned int, tdev->mtu, IP6_MAX_MTU);
+-                      dev->mtu = mtu - t_hlen;
++                      mtu = mtu - t_hlen;
+                       if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT))
+-                              dev->mtu -= 8;
++                              mtu -= 8;
+-                      if (dev->mtu < IPV6_MIN_MTU)
+-                              dev->mtu = IPV6_MIN_MTU;
++                      if (mtu < IPV6_MIN_MTU)
++                              mtu = IPV6_MIN_MTU;
++                      WRITE_ONCE(dev->mtu, mtu);
+               }
+       }
+ }
+diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
+index 637cd99bd7a6..946871741f12 100644
+--- a/net/ipv6/sit.c
++++ b/net/ipv6/sit.c
+@@ -1130,10 +1130,12 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
+       if (tdev && !netif_is_l3_master(tdev)) {
+               int t_hlen = tunnel->hlen + sizeof(struct iphdr);
++              int mtu;
+-              dev->mtu = tdev->mtu - t_hlen;
+-              if (dev->mtu < IPV6_MIN_MTU)
+-                      dev->mtu = IPV6_MIN_MTU;
++              mtu = tdev->mtu - t_hlen;
++              if (mtu < IPV6_MIN_MTU)
++                      mtu = IPV6_MIN_MTU;
++              WRITE_ONCE(dev->mtu, mtu);
+       }
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/kcm-annotate-data-races-around-kcm-rx_psock.patch b/queue-5.15/kcm-annotate-data-races-around-kcm-rx_psock.patch
new file mode 100644 (file)
index 0000000..87c4839
--- /dev/null
@@ -0,0 +1,101 @@
+From 3df3e76e50e7563165d58afce64330fc448ee890 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 22:45:11 +0000
+Subject: kcm: annotate data-races around kcm->rx_psock
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 15e4dabda11b0fa31d510a915d1a580f47dfc92e ]
+
+kcm->rx_psock can be read locklessly in kcm_rfree().
+Annotate the read and writes accordingly.
+
+We do the same for kcm->rx_wait in the following patch.
+
+syzbot reported:
+BUG: KCSAN: data-race in kcm_rfree / unreserve_rx_kcm
+
+write to 0xffff888123d827b8 of 8 bytes by task 2758 on cpu 1:
+unreserve_rx_kcm+0x72/0x1f0 net/kcm/kcmsock.c:313
+kcm_rcv_strparser+0x2b5/0x3a0 net/kcm/kcmsock.c:373
+__strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
+strp_recv+0x6d/0x80 net/strparser/strparser.c:335
+tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
+strp_read_sock net/strparser/strparser.c:358 [inline]
+do_strp_work net/strparser/strparser.c:406 [inline]
+strp_work+0xe8/0x180 net/strparser/strparser.c:415
+process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
+worker_thread+0x618/0xa70 kernel/workqueue.c:2436
+kthread+0x1a9/0x1e0 kernel/kthread.c:376
+ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
+
+read to 0xffff888123d827b8 of 8 bytes by task 5859 on cpu 0:
+kcm_rfree+0x14c/0x220 net/kcm/kcmsock.c:181
+skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
+skb_release_all net/core/skbuff.c:852 [inline]
+__kfree_skb net/core/skbuff.c:868 [inline]
+kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
+kfree_skb include/linux/skbuff.h:1216 [inline]
+kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
+____sys_recvmsg+0x16c/0x2e0
+___sys_recvmsg net/socket.c:2743 [inline]
+do_recvmmsg+0x2f1/0x710 net/socket.c:2837
+__sys_recvmmsg net/socket.c:2916 [inline]
+__do_sys_recvmmsg net/socket.c:2939 [inline]
+__se_sys_recvmmsg net/socket.c:2932 [inline]
+__x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
+do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
+entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+value changed: 0xffff88812971ce00 -> 0x0000000000000000
+
+Reported by Kernel Concurrency Sanitizer on:
+CPU: 0 PID: 5859 Comm: syz-executor.3 Not tainted 6.0.0-syzkaller-12189-g19d17ab7c68b-dirty #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
+
+Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/kcm/kcmsock.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
+index f780fbe82e7d..2e8990036ec4 100644
+--- a/net/kcm/kcmsock.c
++++ b/net/kcm/kcmsock.c
+@@ -177,7 +177,7 @@ static void kcm_rfree(struct sk_buff *skb)
+       /* For reading rx_wait and rx_psock without holding lock */
+       smp_mb__after_atomic();
+-      if (!kcm->rx_wait && !kcm->rx_psock &&
++      if (!kcm->rx_wait && !READ_ONCE(kcm->rx_psock) &&
+           sk_rmem_alloc_get(sk) < sk->sk_rcvlowat) {
+               spin_lock_bh(&mux->rx_lock);
+               kcm_rcv_ready(kcm);
+@@ -282,7 +282,8 @@ static struct kcm_sock *reserve_rx_kcm(struct kcm_psock *psock,
+       kcm->rx_wait = false;
+       psock->rx_kcm = kcm;
+-      kcm->rx_psock = psock;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_psock, psock);
+       spin_unlock_bh(&mux->rx_lock);
+@@ -309,7 +310,8 @@ static void unreserve_rx_kcm(struct kcm_psock *psock,
+       spin_lock_bh(&mux->rx_lock);
+       psock->rx_kcm = NULL;
+-      kcm->rx_psock = NULL;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_psock, NULL);
+       /* Commit kcm->rx_psock before sk_rmem_alloc_get to sync with
+        * kcm_rfree
+-- 
+2.35.1
+
diff --git a/queue-5.15/kcm-annotate-data-races-around-kcm-rx_wait.patch b/queue-5.15/kcm-annotate-data-races-around-kcm-rx_wait.patch
new file mode 100644 (file)
index 0000000..bc6d8b9
--- /dev/null
@@ -0,0 +1,130 @@
+From 196b54775e3d6bb100987c1ebe2891412682cb52 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 22:45:12 +0000
+Subject: kcm: annotate data-races around kcm->rx_wait
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 0c745b5141a45a076f1cb9772a399f7ebcb0948a ]
+
+kcm->rx_psock can be read locklessly in kcm_rfree().
+Annotate the read and writes accordingly.
+
+syzbot reported:
+
+BUG: KCSAN: data-race in kcm_rcv_strparser / kcm_rfree
+
+write to 0xffff88810784e3d0 of 1 bytes by task 1823 on cpu 1:
+reserve_rx_kcm net/kcm/kcmsock.c:283 [inline]
+kcm_rcv_strparser+0x250/0x3a0 net/kcm/kcmsock.c:363
+__strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
+strp_recv+0x6d/0x80 net/strparser/strparser.c:335
+tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
+strp_read_sock net/strparser/strparser.c:358 [inline]
+do_strp_work net/strparser/strparser.c:406 [inline]
+strp_work+0xe8/0x180 net/strparser/strparser.c:415
+process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
+worker_thread+0x618/0xa70 kernel/workqueue.c:2436
+kthread+0x1a9/0x1e0 kernel/kthread.c:376
+ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
+
+read to 0xffff88810784e3d0 of 1 bytes by task 17869 on cpu 0:
+kcm_rfree+0x121/0x220 net/kcm/kcmsock.c:181
+skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
+skb_release_all net/core/skbuff.c:852 [inline]
+__kfree_skb net/core/skbuff.c:868 [inline]
+kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
+kfree_skb include/linux/skbuff.h:1216 [inline]
+kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
+____sys_recvmsg+0x16c/0x2e0
+___sys_recvmsg net/socket.c:2743 [inline]
+do_recvmmsg+0x2f1/0x710 net/socket.c:2837
+__sys_recvmmsg net/socket.c:2916 [inline]
+__do_sys_recvmmsg net/socket.c:2939 [inline]
+__se_sys_recvmmsg net/socket.c:2932 [inline]
+__x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
+do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
+entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+value changed: 0x01 -> 0x00
+
+Reported by Kernel Concurrency Sanitizer on:
+CPU: 0 PID: 17869 Comm: syz-executor.2 Not tainted 6.1.0-rc1-syzkaller-00010-gbb1a1146467a-dirty #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
+
+Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/kcm/kcmsock.c | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
+index 2e8990036ec4..ff6dd2619f22 100644
+--- a/net/kcm/kcmsock.c
++++ b/net/kcm/kcmsock.c
+@@ -161,7 +161,8 @@ static void kcm_rcv_ready(struct kcm_sock *kcm)
+       /* Buffer limit is okay now, add to ready list */
+       list_add_tail(&kcm->wait_rx_list,
+                     &kcm->mux->kcm_rx_waiters);
+-      kcm->rx_wait = true;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_wait, true);
+ }
+ static void kcm_rfree(struct sk_buff *skb)
+@@ -177,7 +178,7 @@ static void kcm_rfree(struct sk_buff *skb)
+       /* For reading rx_wait and rx_psock without holding lock */
+       smp_mb__after_atomic();
+-      if (!kcm->rx_wait && !READ_ONCE(kcm->rx_psock) &&
++      if (!READ_ONCE(kcm->rx_wait) && !READ_ONCE(kcm->rx_psock) &&
+           sk_rmem_alloc_get(sk) < sk->sk_rcvlowat) {
+               spin_lock_bh(&mux->rx_lock);
+               kcm_rcv_ready(kcm);
+@@ -236,7 +237,8 @@ static void requeue_rx_msgs(struct kcm_mux *mux, struct sk_buff_head *head)
+               if (kcm_queue_rcv_skb(&kcm->sk, skb)) {
+                       /* Should mean socket buffer full */
+                       list_del(&kcm->wait_rx_list);
+-                      kcm->rx_wait = false;
++                      /* paired with lockless reads in kcm_rfree() */
++                      WRITE_ONCE(kcm->rx_wait, false);
+                       /* Commit rx_wait to read in kcm_free */
+                       smp_wmb();
+@@ -279,7 +281,8 @@ static struct kcm_sock *reserve_rx_kcm(struct kcm_psock *psock,
+       kcm = list_first_entry(&mux->kcm_rx_waiters,
+                              struct kcm_sock, wait_rx_list);
+       list_del(&kcm->wait_rx_list);
+-      kcm->rx_wait = false;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_wait, false);
+       psock->rx_kcm = kcm;
+       /* paired with lockless reads in kcm_rfree() */
+@@ -1241,7 +1244,8 @@ static void kcm_recv_disable(struct kcm_sock *kcm)
+       if (!kcm->rx_psock) {
+               if (kcm->rx_wait) {
+                       list_del(&kcm->wait_rx_list);
+-                      kcm->rx_wait = false;
++                      /* paired with lockless reads in kcm_rfree() */
++                      WRITE_ONCE(kcm->rx_wait, false);
+               }
+               requeue_rx_msgs(mux, &kcm->sk.sk_receive_queue);
+@@ -1794,7 +1798,8 @@ static void kcm_done(struct kcm_sock *kcm)
+       if (kcm->rx_wait) {
+               list_del(&kcm->wait_rx_list);
+-              kcm->rx_wait = false;
++              /* paired with lockless reads in kcm_rfree() */
++              WRITE_ONCE(kcm->rx_wait, false);
+       }
+       /* Move any pending receive messages to other kcm sockets */
+       requeue_rx_msgs(mux, &sk->sk_receive_queue);
+-- 
+2.35.1
+
diff --git a/queue-5.15/kcm-do-not-sense-pfmemalloc-status-in-kcm_sendpage.patch b/queue-5.15/kcm-do-not-sense-pfmemalloc-status-in-kcm_sendpage.patch
new file mode 100644 (file)
index 0000000..ec96414
--- /dev/null
@@ -0,0 +1,37 @@
+From 17c6f15d33d9ee17a296bf25838d165b9432e3c7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 04:06:37 +0000
+Subject: kcm: do not sense pfmemalloc status in kcm_sendpage()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit ee15e1f38dc201fa7d63c13aa258b728dce27f4d ]
+
+Similar to changes done in TCP in blamed commit.
+We should not sense pfmemalloc status in sendpage() methods.
+
+Fixes: 326140063946 ("tcp: TX zerocopy should not sense pfmemalloc status")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://lore.kernel.org/r/20221027040637.1107703-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/kcm/kcmsock.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
+index ff6dd2619f22..a1478ad393f9 100644
+--- a/net/kcm/kcmsock.c
++++ b/net/kcm/kcmsock.c
+@@ -838,7 +838,7 @@ static ssize_t kcm_sendpage(struct socket *sock, struct page *page,
+       }
+       get_page(page);
+-      skb_fill_page_desc(skb, i, page, offset, size);
++      skb_fill_page_desc_noacc(skb, i, page, offset, size);
+       skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG;
+ coalesced:
+-- 
+2.35.1
+
diff --git a/queue-5.15/kvm-selftests-fix-number-of-pages-for-memory-slot-in.patch b/queue-5.15/kvm-selftests-fix-number-of-pages-for-memory-slot-in.patch
new file mode 100644 (file)
index 0000000..7bef9c5
--- /dev/null
@@ -0,0 +1,62 @@
+From 4bf7e8247e3de1b8972c6bff504764aee7593650 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Oct 2022 14:30:20 +0800
+Subject: KVM: selftests: Fix number of pages for memory slot in
+ memslot_modification_stress_test
+
+From: Gavin Shan <gshan@redhat.com>
+
+[ Upstream commit 05c2224d4b049406b0545a10be05280ff4b8ba0a ]
+
+It's required by vm_userspace_mem_region_add() that memory size
+should be aligned to host page size. However, one guest page is
+provided by memslot_modification_stress_test. It triggers failure
+in the scenario of 64KB-page-size-host and 4KB-page-size-guest,
+as the following messages indicate.
+
+ # ./memslot_modification_stress_test
+ Testing guest mode: PA-bits:40,  VA-bits:48,  4K pages
+ guest physical test memory: [0xffbfff0000, 0xffffff0000)
+ Finished creating vCPUs
+ Started all vCPUs
+ ==== Test Assertion Failure ====
+   lib/kvm_util.c:824: vm_adjust_num_guest_pages(vm->mode, npages) == npages
+   pid=5712 tid=5712 errno=0 - Success
+      1        0x0000000000404eeb: vm_userspace_mem_region_add at kvm_util.c:822
+      2        0x0000000000401a5b: add_remove_memslot at memslot_modification_stress_test.c:82
+      3         (inlined by) run_test at memslot_modification_stress_test.c:110
+      4        0x0000000000402417: for_each_guest_mode at guest_modes.c:100
+      5        0x00000000004016a7: main at memslot_modification_stress_test.c:187
+      6        0x0000ffffb8cd4383: ?? ??:0
+      7        0x0000000000401827: _start at :?
+   Number of guest pages is not compatible with the host. Try npages=16
+
+Fix the issue by providing 16 guest pages to the memory slot for this
+particular combination of 64KB-page-size-host and 4KB-page-size-guest
+on aarch64.
+
+Fixes: ef4c9f4f65462 ("KVM: selftests: Fix 32-bit truncation of vm_get_max_gfn()")
+Signed-off-by: Gavin Shan <gshan@redhat.com>
+Signed-off-by: Marc Zyngier <maz@kernel.org>
+Link: https://lore.kernel.org/r/20221013063020.201856-1-gshan@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/kvm/memslot_modification_stress_test.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/kvm/memslot_modification_stress_test.c b/tools/testing/selftests/kvm/memslot_modification_stress_test.c
+index 4cfcafea9f5a..1d806b8ffee2 100644
+--- a/tools/testing/selftests/kvm/memslot_modification_stress_test.c
++++ b/tools/testing/selftests/kvm/memslot_modification_stress_test.c
+@@ -72,7 +72,7 @@ struct memslot_antagonist_args {
+ static void add_remove_memslot(struct kvm_vm *vm, useconds_t delay,
+                              uint64_t nr_modifications)
+ {
+-      const uint64_t pages = 1;
++      uint64_t pages = max_t(int, vm->page_size, getpagesize()) / vm->page_size;
+       uint64_t gpa;
+       int i;
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-atomisp-prevent-integer-overflow-in-sh_css_set.patch b/queue-5.15/media-atomisp-prevent-integer-overflow-in-sh_css_set.patch
new file mode 100644 (file)
index 0000000..ca6c1b5
--- /dev/null
@@ -0,0 +1,42 @@
+From c69515d0df091040b2296597705f20b4f2d1c58c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Sep 2022 07:20:09 +0200
+Subject: media: atomisp: prevent integer overflow in sh_css_set_black_frame()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 3ad290194bb06979367622e47357462836c1d3b4 ]
+
+The "height" and "width" values come from the user so the "height * width"
+multiplication can overflow.
+
+Link: https://lore.kernel.org/r/YxBBCRnm3mmvaiuR@kili
+
+Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/media/atomisp/pci/sh_css_params.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
+index ccc007879564..deecffd438ae 100644
+--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
++++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
+@@ -962,8 +962,8 @@ sh_css_set_black_frame(struct ia_css_stream *stream,
+               params->fpn_config.data = NULL;
+       }
+       if (!params->fpn_config.data) {
+-              params->fpn_config.data = kvmalloc(height * width *
+-                                                 sizeof(short), GFP_KERNEL);
++              params->fpn_config.data = kvmalloc(array3_size(height, width, sizeof(short)),
++                                                 GFP_KERNEL);
+               if (!params->fpn_config.data) {
+                       IA_CSS_ERROR("out of memory");
+                       IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM);
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch b/queue-5.15/media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch
new file mode 100644 (file)
index 0000000..e2d3a28
--- /dev/null
@@ -0,0 +1,48 @@
+From c20476ffaa7799d50c1292084cdb985ac3dcc79d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Oct 2022 09:00:34 +0100
+Subject: media: v4l2-dv-timings: add sanity checks for blanking values
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 4b6d66a45ed34a15721cb9e11492fa1a24bc83df ]
+
+Add sanity checks to v4l2_valid_dv_timings() to ensure that the provided
+blanking values are reasonable.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: b18787ed1ce3 ([media] v4l2-dv-timings: add new helper module)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/v4l2-core/v4l2-dv-timings.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
+index af48705c704f..003c32fed3f7 100644
+--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
++++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
+@@ -161,6 +161,20 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings *t,
+           (bt->interlaced && !(caps & V4L2_DV_BT_CAP_INTERLACED)) ||
+           (!bt->interlaced && !(caps & V4L2_DV_BT_CAP_PROGRESSIVE)))
+               return false;
++
++      /* sanity checks for the blanking timings */
++      if (!bt->interlaced &&
++          (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch))
++              return false;
++      if (bt->hfrontporch > 2 * bt->width ||
++          bt->hsync > 1024 || bt->hbackporch > 1024)
++              return false;
++      if (bt->vfrontporch > 4096 ||
++          bt->vsync > 128 || bt->vbackporch > 4096)
++              return false;
++      if (bt->interlaced && (bt->il_vfrontporch > 4096 ||
++          bt->il_vsync > 128 || bt->il_vbackporch > 4096))
++              return false;
+       return fnc == NULL || fnc(t, fnc_handle);
+ }
+ EXPORT_SYMBOL_GPL(v4l2_valid_dv_timings);
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-v4l2-fix-v4l2_i2c_subdev_set_name-function-doc.patch b/queue-5.15/media-v4l2-fix-v4l2_i2c_subdev_set_name-function-doc.patch
new file mode 100644 (file)
index 0000000..aed557f
--- /dev/null
@@ -0,0 +1,41 @@
+From 47a763875ba0849a76310199a719d7649d6d82da Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Jul 2022 09:11:31 +0200
+Subject: media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alexander Stein <alexander.stein@ew.tq-group.com>
+
+[ Upstream commit bb9ea2c31fa11b789ade4c3abcdda3c5370a76ab ]
+
+The doc says the I²C device's name is used if devname is NULL, but
+actually the I²C device driver's name is used.
+
+Fixes: 0658293012af ("media: v4l: subdev: Add a function to set an I²C sub-device's name")
+Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/media/v4l2-common.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
+index 3eb202259e8c..5e25a098e8ce 100644
+--- a/include/media/v4l2-common.h
++++ b/include/media/v4l2-common.h
+@@ -175,7 +175,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
+  *
+  * @sd: pointer to &struct v4l2_subdev
+  * @client: pointer to struct i2c_client
+- * @devname: the name of the device; if NULL, the I²C device's name will be used
++ * @devname: the name of the device; if NULL, the I²C device drivers's name
++ *           will be used
+  * @postfix: sub-device specific string to put right after the I²C device name;
+  *         may be NULL
+  */
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch b/queue-5.15/media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch
new file mode 100644 (file)
index 0000000..95a21d9
--- /dev/null
@@ -0,0 +1,38 @@
+From ef9f85065ba403a92bdbad17d67317951cbbd25e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Oct 2022 16:46:17 +0100
+Subject: media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check
+ 'interlaced'
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 8da7f0976b9071b528c545008de9d10cc81883b1 ]
+
+If it is a progressive (non-interlaced) format, then ignore the
+interlaced timing values.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: 7f68127fa11f ([media] videodev2.h: defines to calculate blanking and frame sizes)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/uapi/linux/videodev2.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
+index 9260791b8438..61c5011dfc13 100644
+--- a/include/uapi/linux/videodev2.h
++++ b/include/uapi/linux/videodev2.h
+@@ -1560,7 +1560,8 @@ struct v4l2_bt_timings {
+       ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
+ #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
+       ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \
+-       (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch)
++       ((bt)->interlaced ? \
++        ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0))
+ #define V4L2_DV_BT_FRAME_HEIGHT(bt) \
+       ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch b/queue-5.15/media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch
new file mode 100644 (file)
index 0000000..a7d26c2
--- /dev/null
@@ -0,0 +1,75 @@
+From 1b736afce3254ce5d3ea7ba90293a4203f215435 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Oct 2022 15:18:46 +0100
+Subject: media: vivid: dev->bitmap_cap wasn't freed in all cases
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 1f65ea411cc7b6ff128d82a3493d7b5648054e6f ]
+
+Whenever the compose width/height values change, the dev->bitmap_cap
+vmalloc'ed array must be freed and dev->bitmap_cap set to NULL.
+
+This was done in some places, but not all. This is only an issue if
+overlay support is enabled and the bitmap clipping is used.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../media/test-drivers/vivid/vivid-vid-cap.c   | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/media/test-drivers/vivid/vivid-vid-cap.c b/drivers/media/test-drivers/vivid/vivid-vid-cap.c
+index c9eb28b3a03d..99139a8cd4c4 100644
+--- a/drivers/media/test-drivers/vivid/vivid-vid-cap.c
++++ b/drivers/media/test-drivers/vivid/vivid-vid-cap.c
+@@ -452,6 +452,12 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool keep_controls)
+       tpg_reset_source(&dev->tpg, dev->src_rect.width, dev->src_rect.height, dev->field_cap);
+       dev->crop_cap = dev->src_rect;
+       dev->crop_bounds_cap = dev->src_rect;
++      if (dev->bitmap_cap &&
++          (dev->compose_cap.width != dev->crop_cap.width ||
++           dev->compose_cap.height != dev->crop_cap.height)) {
++              vfree(dev->bitmap_cap);
++              dev->bitmap_cap = NULL;
++      }
+       dev->compose_cap = dev->crop_cap;
+       if (V4L2_FIELD_HAS_T_OR_B(dev->field_cap))
+               dev->compose_cap.height /= 2;
+@@ -909,6 +915,8 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
+       struct vivid_dev *dev = video_drvdata(file);
+       struct v4l2_rect *crop = &dev->crop_cap;
+       struct v4l2_rect *compose = &dev->compose_cap;
++      unsigned orig_compose_w = compose->width;
++      unsigned orig_compose_h = compose->height;
+       unsigned factor = V4L2_FIELD_HAS_T_OR_B(dev->field_cap) ? 2 : 1;
+       int ret;
+@@ -1025,17 +1033,17 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
+                       s->r.height /= factor;
+               }
+               v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect);
+-              if (dev->bitmap_cap && (compose->width != s->r.width ||
+-                                      compose->height != s->r.height)) {
+-                      vfree(dev->bitmap_cap);
+-                      dev->bitmap_cap = NULL;
+-              }
+               *compose = s->r;
+               break;
+       default:
+               return -EINVAL;
+       }
++      if (dev->bitmap_cap && (compose->width != orig_compose_w ||
++                              compose->height != orig_compose_h)) {
++              vfree(dev->bitmap_cap);
++              dev->bitmap_cap = NULL;
++      }
+       tpg_s_crop_compose(&dev->tpg, crop, compose);
+       return 0;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-vivid-s_fbuf-add-more-sanity-checks.patch b/queue-5.15/media-vivid-s_fbuf-add-more-sanity-checks.patch
new file mode 100644 (file)
index 0000000..7698c30
--- /dev/null
@@ -0,0 +1,90 @@
+From 0bf35149018adbc002420a910345c440cf79aa3c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Oct 2022 15:32:28 +0100
+Subject: media: vivid: s_fbuf: add more sanity checks
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit f8bcaf714abfc94818dff8c0db84d750433984f4 ]
+
+VIDIOC_S_FBUF is by definition a scary ioctl, which is why only root
+can use it. But at least check if the framebuffer parameters match that
+of one of the framebuffer created by vivid, and reject anything else.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: ef834f7836ec ([media] vivid: add the video capture and output parts)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/test-drivers/vivid/vivid-core.c | 22 +++++++++++++++++++
+ drivers/media/test-drivers/vivid/vivid-core.h |  2 ++
+ .../media/test-drivers/vivid/vivid-vid-cap.c  |  9 +++++++-
+ 3 files changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
+index d2bd2653cf54..e7cc70a92683 100644
+--- a/drivers/media/test-drivers/vivid/vivid-core.c
++++ b/drivers/media/test-drivers/vivid/vivid-core.c
+@@ -330,6 +330,28 @@ static int vidioc_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *a
+       return vivid_vid_out_g_fbuf(file, fh, a);
+ }
++/*
++ * Only support the framebuffer of one of the vivid instances.
++ * Anything else is rejected.
++ */
++bool vivid_validate_fb(const struct v4l2_framebuffer *a)
++{
++      struct vivid_dev *dev;
++      int i;
++
++      for (i = 0; i < n_devs; i++) {
++              dev = vivid_devs[i];
++              if (!dev || !dev->video_pbase)
++                      continue;
++              if ((unsigned long)a->base == dev->video_pbase &&
++                  a->fmt.width <= dev->display_width &&
++                  a->fmt.height <= dev->display_height &&
++                  a->fmt.bytesperline <= dev->display_byte_stride)
++                      return true;
++      }
++      return false;
++}
++
+ static int vidioc_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffer *a)
+ {
+       struct video_device *vdev = video_devdata(file);
+diff --git a/drivers/media/test-drivers/vivid/vivid-core.h b/drivers/media/test-drivers/vivid/vivid-core.h
+index 1e3c4f5a9413..7ceaf9bac2f0 100644
+--- a/drivers/media/test-drivers/vivid/vivid-core.h
++++ b/drivers/media/test-drivers/vivid/vivid-core.h
+@@ -610,4 +610,6 @@ static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev)
+       return dev->output_type[dev->output] == HDMI;
+ }
++bool vivid_validate_fb(const struct v4l2_framebuffer *a);
++
+ #endif
+diff --git a/drivers/media/test-drivers/vivid/vivid-vid-cap.c b/drivers/media/test-drivers/vivid/vivid-vid-cap.c
+index b9caa4b26209..c9eb28b3a03d 100644
+--- a/drivers/media/test-drivers/vivid/vivid-vid-cap.c
++++ b/drivers/media/test-drivers/vivid/vivid-vid-cap.c
+@@ -1272,7 +1272,14 @@ int vivid_vid_cap_s_fbuf(struct file *file, void *fh,
+               return -EINVAL;
+       if (a->fmt.bytesperline < (a->fmt.width * fmt->bit_depth[0]) / 8)
+               return -EINVAL;
+-      if (a->fmt.height * a->fmt.bytesperline < a->fmt.sizeimage)
++      if (a->fmt.bytesperline > a->fmt.sizeimage / a->fmt.height)
++              return -EINVAL;
++
++      /*
++       * Only support the framebuffer of one of the vivid instances.
++       * Anything else is rejected.
++       */
++      if (!vivid_validate_fb(a))
+               return -EINVAL;
+       dev->fb_vbase_cap = phys_to_virt((unsigned long)a->base);
+-- 
+2.35.1
+
diff --git a/queue-5.15/media-vivid-set-num_in-outputs-to-0-if-not-supported.patch b/queue-5.15/media-vivid-set-num_in-outputs-to-0-if-not-supported.patch
new file mode 100644 (file)
index 0000000..dda76d9
--- /dev/null
@@ -0,0 +1,57 @@
+From 0225aa684b1515e7412c95ff72269ed7a89e6c94 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Oct 2022 15:09:06 +0100
+Subject: media: vivid: set num_in/outputs to 0 if not supported
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 69d78a80da4ef12faf2a6f9cfa2097ab4ac43983 ]
+
+If node_types does not have video/vbi/meta inputs or outputs,
+then set num_inputs/num_outputs to 0 instead of 1.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Fixes: 0c90f649d2f5 (media: vivid: add vivid_create_queue() helper)
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/test-drivers/vivid/vivid-core.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c
+index e7cc70a92683..065bdc33f049 100644
+--- a/drivers/media/test-drivers/vivid/vivid-core.c
++++ b/drivers/media/test-drivers/vivid/vivid-core.c
+@@ -932,8 +932,12 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
+       /* how many inputs do we have and of what type? */
+       dev->num_inputs = num_inputs[inst];
+-      if (dev->num_inputs < 1)
+-              dev->num_inputs = 1;
++      if (node_type & 0x20007) {
++              if (dev->num_inputs < 1)
++                      dev->num_inputs = 1;
++      } else {
++              dev->num_inputs = 0;
++      }
+       if (dev->num_inputs >= MAX_INPUTS)
+               dev->num_inputs = MAX_INPUTS;
+       for (i = 0; i < dev->num_inputs; i++) {
+@@ -950,8 +954,12 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst,
+       /* how many outputs do we have and of what type? */
+       dev->num_outputs = num_outputs[inst];
+-      if (dev->num_outputs < 1)
+-              dev->num_outputs = 1;
++      if (node_type & 0x40300) {
++              if (dev->num_outputs < 1)
++                      dev->num_outputs = 1;
++      } else {
++              dev->num_outputs = 0;
++      }
+       if (dev->num_outputs >= MAX_OUTPUTS)
+               dev->num_outputs = MAX_OUTPUTS;
+       for (i = 0; i < dev->num_outputs; i++) {
+-- 
+2.35.1
+
diff --git a/queue-5.15/mtd-rawnand-intel-add-missing-of_node_put-in-ebu_nan.patch b/queue-5.15/mtd-rawnand-intel-add-missing-of_node_put-in-ebu_nan.patch
new file mode 100644 (file)
index 0000000..a5041e5
--- /dev/null
@@ -0,0 +1,79 @@
+From d486c4ada926bfd6bd80d01afbf41e5187b9f27e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 24 Sep 2022 21:10:10 +0800
+Subject: mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 1f3b494d1fc18ebb37aaa47107e9b84bf5b54ff7 ]
+
+The 'chip_np' returned by of_get_next_child() with refcount decremented,
+of_node_put() need be called in error path to decrease the refcount.
+
+Fixes: bfc618fcc3f1 ("mtd: rawnand: intel: Read the chip-select line from the correct OF node")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20220924131010.957117-1-yangyingliang@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mtd/nand/raw/intel-nand-controller.c | 19 ++++++++++++-------
+ 1 file changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c
+index 056835fd4562..53071e791e17 100644
+--- a/drivers/mtd/nand/raw/intel-nand-controller.c
++++ b/drivers/mtd/nand/raw/intel-nand-controller.c
+@@ -614,11 +614,12 @@ static int ebu_nand_probe(struct platform_device *pdev)
+       ret = of_property_read_u32(chip_np, "reg", &cs);
+       if (ret) {
+               dev_err(dev, "failed to get chip select: %d\n", ret);
+-              return ret;
++              goto err_of_node_put;
+       }
+       if (cs >= MAX_CS) {
+               dev_err(dev, "got invalid chip select: %d\n", cs);
+-              return -EINVAL;
++              ret = -EINVAL;
++              goto err_of_node_put;
+       }
+       ebu_host->cs_num = cs;
+@@ -627,18 +628,20 @@ static int ebu_nand_probe(struct platform_device *pdev)
+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname);
+       ebu_host->cs[cs].chipaddr = devm_ioremap_resource(dev, res);
+       if (IS_ERR(ebu_host->cs[cs].chipaddr))
+-              return PTR_ERR(ebu_host->cs[cs].chipaddr);
++              goto err_of_node_put;
+       ebu_host->cs[cs].nand_pa = res->start;
+       ebu_host->clk = devm_clk_get(dev, NULL);
+-      if (IS_ERR(ebu_host->clk))
+-              return dev_err_probe(dev, PTR_ERR(ebu_host->clk),
+-                                   "failed to get clock\n");
++      if (IS_ERR(ebu_host->clk)) {
++              ret = dev_err_probe(dev, PTR_ERR(ebu_host->clk),
++                                  "failed to get clock\n");
++              goto err_of_node_put;
++      }
+       ret = clk_prepare_enable(ebu_host->clk);
+       if (ret) {
+               dev_err(dev, "failed to enable clock: %d\n", ret);
+-              return ret;
++              goto err_of_node_put;
+       }
+       ebu_host->clk_rate = clk_get_rate(ebu_host->clk);
+@@ -703,6 +706,8 @@ static int ebu_nand_probe(struct platform_device *pdev)
+       ebu_dma_cleanup(ebu_host);
+ err_disable_unprepare_clk:
+       clk_disable_unprepare(ebu_host->clk);
++err_of_node_put:
++      of_node_put(chip_np);
+       return ret;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-bcmsysport-indicate-mac-is-in-charge-of-phy-pm.patch b/queue-5.15/net-bcmsysport-indicate-mac-is-in-charge-of-phy-pm.patch
new file mode 100644 (file)
index 0000000..44361b0
--- /dev/null
@@ -0,0 +1,40 @@
+From b3c1656ce420c201e76b09e55569ae2b66b7e4e2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Oct 2022 16:42:01 -0700
+Subject: net: bcmsysport: Indicate MAC is in charge of PHY PM
+
+From: Florian Fainelli <f.fainelli@gmail.com>
+
+[ Upstream commit 9f172134dde7e4f5bf4b9139f23a1e741ec1c36e ]
+
+Avoid the PHY library call unnecessarily into the suspend/resume
+functions by setting phydev->mac_managed_pm to true. The SYSTEMPORT
+driver essentially does exactly what mdio_bus_phy_resume() does by
+calling phy_resume().
+
+Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Link: https://lore.kernel.org/r/20221025234201.2549360-1-f.fainelli@gmail.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/broadcom/bcmsysport.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
+index ae541a9d1eee..4c7f828c69c6 100644
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c
+@@ -1991,6 +1991,9 @@ static int bcm_sysport_open(struct net_device *dev)
+               goto out_clk_disable;
+       }
++      /* Indicate that the MAC is responsible for PHY PM */
++      phydev->mac_managed_pm = true;
++
+       /* Reset house keeping link status */
+       priv->old_duplex = -1;
+       priv->old_link = -1;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-broadcom-bcm4908_enet-update-tx-stats-after-actu.patch b/queue-5.15/net-broadcom-bcm4908_enet-update-tx-stats-after-actu.patch
new file mode 100644 (file)
index 0000000..ed4719b
--- /dev/null
@@ -0,0 +1,75 @@
+From acb6f664ecc6f6ec96be6219111260d12a530bcf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 13:24:30 +0200
+Subject: net: broadcom: bcm4908_enet: update TX stats after actual
+ transmission
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Rafał Miłecki <rafal@milecki.pl>
+
+[ Upstream commit ef3556ee16c68735ec69bd08df41d1cd83b14ad3 ]
+
+Queueing packets doesn't guarantee their transmission. Update TX stats
+after hardware confirms consuming submitted data.
+
+This also fixes a possible race and NULL dereference.
+bcm4908_enet_start_xmit() could try to access skb after freeing it in
+the bcm4908_enet_poll_tx().
+
+Reported-by: Florian Fainelli <f.fainelli@gmail.com>
+Fixes: 4feffeadbcb2e ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Link: https://lore.kernel.org/r/20221027112430.8696-1-zajec5@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/broadcom/bcm4908_enet.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
+index 994731a33e18..7e89664943ce 100644
+--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
+@@ -561,8 +561,6 @@ static int bcm4908_enet_start_xmit(struct sk_buff *skb, struct net_device *netde
+       if (++ring->write_idx == ring->length - 1)
+               ring->write_idx = 0;
+-      enet->netdev->stats.tx_bytes += skb->len;
+-      enet->netdev->stats.tx_packets++;
+       return NETDEV_TX_OK;
+ }
+@@ -635,6 +633,7 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
+       struct bcm4908_enet_dma_ring_bd *buf_desc;
+       struct bcm4908_enet_dma_ring_slot *slot;
+       struct device *dev = enet->dev;
++      unsigned int bytes = 0;
+       int handled = 0;
+       while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) {
+@@ -645,12 +644,17 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
+               dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
+               dev_kfree_skb(slot->skb);
+-              if (++tx_ring->read_idx == tx_ring->length)
+-                      tx_ring->read_idx = 0;
+               handled++;
++              bytes += slot->len;
++
++              if (++tx_ring->read_idx == tx_ring->length)
++                      tx_ring->read_idx = 0;
+       }
++      enet->netdev->stats.tx_packets += handled;
++      enet->netdev->stats.tx_bytes += bytes;
++
+       if (handled < weight) {
+               napi_complete_done(napi, handled);
+               bcm4908_enet_dma_ring_intrs_on(enet, tx_ring);
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-broadcom-bcm4908enet-remove-redundant-variable-b.patch b/queue-5.15/net-broadcom-bcm4908enet-remove-redundant-variable-b.patch
new file mode 100644 (file)
index 0000000..73efa94
--- /dev/null
@@ -0,0 +1,45 @@
+From 71af494bc115d700da8dd32fe4fce6b69cf5df6e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 Dec 2021 00:39:37 +0000
+Subject: net: broadcom: bcm4908enet: remove redundant variable bytes
+
+From: Colin Ian King <colin.i.king@gmail.com>
+
+[ Upstream commit 62a3106697f3c6f9af64a2cd0f9ff58552010dc8 ]
+
+The variable bytes is being used to summate slot lengths,
+however the value is never used afterwards. The summation
+is redundant so remove variable bytes.
+
+Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
+Link: https://lore.kernel.org/r/20211222003937.727325-1-colin.i.king@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: ef3556ee16c6 ("net: broadcom: bcm4908_enet: update TX stats after actual transmission")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/broadcom/bcm4908_enet.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/broadcom/bcm4908_enet.c b/drivers/net/ethernet/broadcom/bcm4908_enet.c
+index 376f81796a29..994731a33e18 100644
+--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
++++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
+@@ -635,7 +635,6 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
+       struct bcm4908_enet_dma_ring_bd *buf_desc;
+       struct bcm4908_enet_dma_ring_slot *slot;
+       struct device *dev = enet->dev;
+-      unsigned int bytes = 0;
+       int handled = 0;
+       while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) {
+@@ -646,7 +645,6 @@ static int bcm4908_enet_poll_tx(struct napi_struct *napi, int weight)
+               dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE);
+               dev_kfree_skb(slot->skb);
+-              bytes += slot->len;
+               if (++tx_ring->read_idx == tx_ring->length)
+                       tx_ring->read_idx = 0;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-do-not-sense-pfmemalloc-status-in-skb_append_pag.patch b/queue-5.15/net-do-not-sense-pfmemalloc-status-in-skb_append_pag.patch
new file mode 100644 (file)
index 0000000..c908832
--- /dev/null
@@ -0,0 +1,103 @@
+From 2e8b4a943ceefe789b427d915b1ca97a3ce5e4c7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 04:03:46 +0000
+Subject: net: do not sense pfmemalloc status in skb_append_pagefrags()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 228ebc41dfab5b5d34cd76835ddb0ca8ee12f513 ]
+
+skb_append_pagefrags() is used by af_unix and udp sendpage()
+implementation so far.
+
+In commit 326140063946 ("tcp: TX zerocopy should not sense
+pfmemalloc status") we explained why we should not sense
+pfmemalloc status for pages owned by user space.
+
+We should also use skb_fill_page_desc_noacc()
+in skb_append_pagefrags() to avoid following KCSAN report:
+
+BUG: KCSAN: data-race in lru_add_fn / skb_append_pagefrags
+
+write to 0xffffea00058fc1c8 of 8 bytes by task 17319 on cpu 0:
+__list_add include/linux/list.h:73 [inline]
+list_add include/linux/list.h:88 [inline]
+lruvec_add_folio include/linux/mm_inline.h:323 [inline]
+lru_add_fn+0x327/0x410 mm/swap.c:228
+folio_batch_move_lru+0x1e1/0x2a0 mm/swap.c:246
+lru_add_drain_cpu+0x73/0x250 mm/swap.c:669
+lru_add_drain+0x21/0x60 mm/swap.c:773
+free_pages_and_swap_cache+0x16/0x70 mm/swap_state.c:311
+tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
+tlb_flush_mmu_free mm/mmu_gather.c:256 [inline]
+tlb_flush_mmu+0x5b2/0x640 mm/mmu_gather.c:263
+tlb_finish_mmu+0x86/0x100 mm/mmu_gather.c:363
+exit_mmap+0x190/0x4d0 mm/mmap.c:3098
+__mmput+0x27/0x1b0 kernel/fork.c:1185
+mmput+0x3d/0x50 kernel/fork.c:1207
+copy_process+0x19fc/0x2100 kernel/fork.c:2518
+kernel_clone+0x166/0x550 kernel/fork.c:2671
+__do_sys_clone kernel/fork.c:2812 [inline]
+__se_sys_clone kernel/fork.c:2796 [inline]
+__x64_sys_clone+0xc3/0xf0 kernel/fork.c:2796
+do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
+entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+read to 0xffffea00058fc1c8 of 8 bytes by task 17325 on cpu 1:
+page_is_pfmemalloc include/linux/mm.h:1817 [inline]
+__skb_fill_page_desc include/linux/skbuff.h:2432 [inline]
+skb_fill_page_desc include/linux/skbuff.h:2453 [inline]
+skb_append_pagefrags+0x210/0x600 net/core/skbuff.c:3974
+unix_stream_sendpage+0x45e/0x990 net/unix/af_unix.c:2338
+kernel_sendpage+0x184/0x300 net/socket.c:3561
+sock_sendpage+0x5a/0x70 net/socket.c:1054
+pipe_to_sendpage+0x128/0x160 fs/splice.c:361
+splice_from_pipe_feed fs/splice.c:415 [inline]
+__splice_from_pipe+0x222/0x4d0 fs/splice.c:559
+splice_from_pipe fs/splice.c:594 [inline]
+generic_splice_sendpage+0x89/0xc0 fs/splice.c:743
+do_splice_from fs/splice.c:764 [inline]
+direct_splice_actor+0x80/0xa0 fs/splice.c:931
+splice_direct_to_actor+0x305/0x620 fs/splice.c:886
+do_splice_direct+0xfb/0x180 fs/splice.c:974
+do_sendfile+0x3bf/0x910 fs/read_write.c:1255
+__do_sys_sendfile64 fs/read_write.c:1323 [inline]
+__se_sys_sendfile64 fs/read_write.c:1309 [inline]
+__x64_sys_sendfile64+0x10c/0x150 fs/read_write.c:1309
+do_syscall_x64 arch/x86/entry/common.c:50 [inline]
+do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
+entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+value changed: 0x0000000000000000 -> 0xffffea00058fc188
+
+Reported by Kernel Concurrency Sanitizer on:
+CPU: 1 PID: 17325 Comm: syz-executor.0 Not tainted 6.1.0-rc1-syzkaller-00158-g440b7895c990-dirty #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
+
+Fixes: 326140063946 ("tcp: TX zerocopy should not sense pfmemalloc status")
+Reported-by: syzbot <syzkaller@googlegroups.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://lore.kernel.org/r/20221027040346.1104204-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/skbuff.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c
+index 3c193e7d4bc6..9cc607b2d3d2 100644
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -3821,7 +3821,7 @@ int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
+               skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], size);
+       } else if (i < MAX_SKB_FRAGS) {
+               get_page(page);
+-              skb_fill_page_desc(skb, i, page, offset, size);
++              skb_fill_page_desc_noacc(skb, i, page, offset, size);
+       } else {
+               return -EMSGSIZE;
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch b/queue-5.15/net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch
new file mode 100644 (file)
index 0000000..d0baa7b
--- /dev/null
@@ -0,0 +1,39 @@
+From a92fcdae985c522395c8f3672ba8e615150b9c08 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Oct 2022 21:00:11 +0800
+Subject: net: ehea: fix possible memory leak in ehea_register_port()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 0e7ce23a917a9cc83ca3c779fbba836bca3bcf1e ]
+
+If of_device_register() returns error, the of node and the
+name allocated in dev_set_name() is leaked, call put_device()
+to give up the reference that was set in device_initialize(),
+so that of node is put in logical_port_release() and the name
+is freed in kobject_cleanup().
+
+Fixes: 1acf2318dd13 ("ehea: dynamic add / remove port")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221025130011.1071357-1-yangyingliang@huawei.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ibm/ehea/ehea_main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
+index d5df131b183c..6c534b92aeed 100644
+--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
+@@ -2898,6 +2898,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
+       ret = of_device_register(&port->ofdev);
+       if (ret) {
+               pr_err("failed to register device. ret=%d\n", ret);
++              put_device(&port->ofdev.dev);
+               goto out;
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-enetc-survive-memory-pressure-without-crashing.patch b/queue-5.15/net-enetc-survive-memory-pressure-without-crashing.patch
new file mode 100644 (file)
index 0000000..618bd8c
--- /dev/null
@@ -0,0 +1,101 @@
+From 7c3dd5ed94af59c781cd41d00b6ddb7eaca24d30 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Oct 2022 21:29:25 +0300
+Subject: net: enetc: survive memory pressure without crashing
+
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+
+[ Upstream commit 84ce1ca3fe9e1249bf21176ff162200f1c4e5ed1 ]
+
+Under memory pressure, enetc_refill_rx_ring() may fail, and when called
+during the enetc_open() -> enetc_setup_rxbdr() procedure, this is not
+checked for.
+
+An extreme case of memory pressure will result in exactly zero buffers
+being allocated for the RX ring, and in such a case it is expected that
+hardware drops all RX packets due to lack of buffers.
+
+This does not happen, because the reset-default value of the consumer
+and produces index is 0, and this makes the ENETC think that all buffers
+have been initialized and that it owns them (when in reality none were).
+
+The hardware guide explains this best:
+
+| Configure the receive ring producer index register RBaPIR with a value
+| of 0. The producer index is initially configured by software but owned
+| by hardware after the ring has been enabled. Hardware increments the
+| index when a frame is received which may consume one or more BDs.
+| Hardware is not allowed to increment the producer index to match the
+| consumer index since it is used to indicate an empty condition. The ring
+| can hold at most RBLENR[LENGTH]-1 received BDs.
+|
+| Configure the receive ring consumer index register RBaCIR. The
+| consumer index is owned by software and updated during operation of the
+| of the BD ring by software, to indicate that any receive data occupied
+| in the BD has been processed and it has been prepared for new data.
+| - If consumer index and producer index are initialized to the same
+|   value, it indicates that all BDs in the ring have been prepared and
+|   hardware owns all of the entries.
+| - If consumer index is initialized to producer index plus N, it would
+|   indicate N BDs have been prepared. Note that hardware cannot start if
+|   only a single buffer is prepared due to the restrictions described in
+|   (2).
+| - Software may write consumer index to match producer index anytime
+|   while the ring is operational to indicate all received BDs prior have
+|   been processed and new BDs prepared for hardware.
+
+Normally, the value of rx_ring->rcir (consumer index) is brought in sync
+with the rx_ring->next_to_use software index, but this only happens if
+page allocation ever succeeded.
+
+When PI==CI==0, the hardware appears to receive frames and write them to
+DMA address 0x0 (?!), then set the READY bit in the BD.
+
+The enetc_clean_rx_ring() function (and its XDP derivative) is naturally
+not prepared to handle such a condition. It will attempt to process
+those frames using the rx_swbd structure associated with index i of the
+RX ring, but that structure is not fully initialized (enetc_new_page()
+does all of that). So what happens next is undefined behavior.
+
+To operate using no buffer, we must initialize the CI to PI + 1, which
+will block the hardware from advancing the CI any further, and drop
+everything.
+
+The issue was seen while adding support for zero-copy AF_XDP sockets,
+where buffer memory comes from user space, which can even decide to
+supply no buffers at all (example: "xdpsock --txonly"). However, the bug
+is present also with the network stack code, even though it would take a
+very determined person to trigger a page allocation failure at the
+perfect time (a series of ifup/ifdown under memory pressure should
+eventually reproduce it given enough retries).
+
+Fixes: d4fd0404c1c9 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
+Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
+Link: https://lore.kernel.org/r/20221027182925.3256653-1-vladimir.oltean@nxp.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/freescale/enetc/enetc.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
+index c0265a6f10c0..77d765809c1e 100644
+--- a/drivers/net/ethernet/freescale/enetc/enetc.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc.c
+@@ -1800,7 +1800,12 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring)
+       else
+               enetc_rxbdr_wr(hw, idx, ENETC_RBBSR, ENETC_RXB_DMA_SIZE);
++      /* Also prepare the consumer index in case page allocation never
++       * succeeds. In that case, hardware will never advance producer index
++       * to match consumer index, and will drop all frames.
++       */
+       enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0);
++      enetc_rxbdr_wr(hw, idx, ENETC_RBCIR, 1);
+       /* enable Rx ints by setting pkt thr to 1 */
+       enetc_rxbdr_wr(hw, idx, ENETC_RBICR0, ENETC_RBICR0_ICEN | 0x1);
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-ethernet-ave-fix-mac-to-be-in-charge-of-phy-pm.patch b/queue-5.15/net-ethernet-ave-fix-mac-to-be-in-charge-of-phy-pm.patch
new file mode 100644 (file)
index 0000000..267e55f
--- /dev/null
@@ -0,0 +1,56 @@
+From a52e51d9512a4974270f752bb3b5aebe07ae322f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 16:22:27 +0900
+Subject: net: ethernet: ave: Fix MAC to be in charge of PHY PM
+
+From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+
+[ Upstream commit e2badb4bd33abe13ddc35975bd7f7f8693955a4b ]
+
+The phylib callback is called after MAC driver's own resume callback is
+called. For AVE driver, after resuming immediately, PHY state machine is
+in PHY_NOLINK because there is a time lag from link-down to link-up due to
+autoneg. The result is WARN_ON() dump in mdio_bus_phy_resume().
+
+Since ave_resume() itself calls phy_resume(), AVE driver should manage
+PHY PM. To indicate that MAC driver manages PHY PM, set
+phydev->mac_managed_pm to true to avoid the unnecessary phylib call and
+add missing phy_init_hw() to ave_resume().
+
+Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
+Fixes: fba863b81604 ("net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM")
+Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+Link: https://lore.kernel.org/r/20221024072227.24769-1-hayashi.kunihiko@socionext.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/socionext/sni_ave.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
+index ae31ed93aaf0..57dc9680ad50 100644
+--- a/drivers/net/ethernet/socionext/sni_ave.c
++++ b/drivers/net/ethernet/socionext/sni_ave.c
+@@ -1229,6 +1229,8 @@ static int ave_init(struct net_device *ndev)
+       phy_support_asym_pause(phydev);
++      phydev->mac_managed_pm = true;
++
+       phy_attached_info(phydev);
+       return 0;
+@@ -1758,6 +1760,10 @@ static int ave_resume(struct device *dev)
+       ave_global_reset(ndev);
++      ret = phy_init_hw(ndev->phydev);
++      if (ret)
++              return ret;
++
+       ave_ethtool_get_wol(ndev, &wol);
+       wol.wolopts = priv->wolopts;
+       __ave_ethtool_set_wol(ndev, &wol);
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-fec-limit-register-access-on-i.mx6ul.patch b/queue-5.15/net-fec-limit-register-access-on-i.mx6ul.patch
new file mode 100644 (file)
index 0000000..5a2568e
--- /dev/null
@@ -0,0 +1,105 @@
+From 1d617d967d773a38b15a13238fab2c3fef2874a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 10:05:52 +0200
+Subject: net: fec: limit register access on i.MX6UL
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Juergen Borleis <jbe@pengutronix.de>
+
+[ Upstream commit 0a8b43b12dd78daa77a7dc007b92770d262a2714 ]
+
+Using 'ethtool -d […]' on an i.MX6UL leads to a kernel crash:
+
+   Unhandled fault: external abort on non-linefetch (0x1008) at […]
+
+due to this SoC has less registers in its FEC implementation compared to other
+i.MX6 variants. Thus, a run-time decision is required to avoid access to
+non-existing registers.
+
+Fixes: a51d3ab50702 ("net: fec: use a more proper compatible string for i.MX6UL type device")
+Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://lore.kernel.org/r/20221024080552.21004-1-jbe@pengutronix.de
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/freescale/fec_main.c | 46 ++++++++++++++++++++++-
+ 1 file changed, 44 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
+index 67eb9b671244..313ae8112067 100644
+--- a/drivers/net/ethernet/freescale/fec_main.c
++++ b/drivers/net/ethernet/freescale/fec_main.c
+@@ -2336,6 +2336,31 @@ static u32 fec_enet_register_offset[] = {
+       IEEE_R_DROP, IEEE_R_FRAME_OK, IEEE_R_CRC, IEEE_R_ALIGN, IEEE_R_MACERR,
+       IEEE_R_FDXFC, IEEE_R_OCTETS_OK
+ };
++/* for i.MX6ul */
++static u32 fec_enet_register_offset_6ul[] = {
++      FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0,
++      FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL,
++      FEC_X_CNTRL, FEC_ADDR_LOW, FEC_ADDR_HIGH, FEC_OPD, FEC_TXIC0, FEC_RXIC0,
++      FEC_HASH_TABLE_HIGH, FEC_HASH_TABLE_LOW, FEC_GRP_HASH_TABLE_HIGH,
++      FEC_GRP_HASH_TABLE_LOW, FEC_X_WMRK, FEC_R_DES_START_0,
++      FEC_X_DES_START_0, FEC_R_BUFF_SIZE_0, FEC_R_FIFO_RSFL, FEC_R_FIFO_RSEM,
++      FEC_R_FIFO_RAEM, FEC_R_FIFO_RAFL, FEC_RACC,
++      RMON_T_DROP, RMON_T_PACKETS, RMON_T_BC_PKT, RMON_T_MC_PKT,
++      RMON_T_CRC_ALIGN, RMON_T_UNDERSIZE, RMON_T_OVERSIZE, RMON_T_FRAG,
++      RMON_T_JAB, RMON_T_COL, RMON_T_P64, RMON_T_P65TO127, RMON_T_P128TO255,
++      RMON_T_P256TO511, RMON_T_P512TO1023, RMON_T_P1024TO2047,
++      RMON_T_P_GTE2048, RMON_T_OCTETS,
++      IEEE_T_DROP, IEEE_T_FRAME_OK, IEEE_T_1COL, IEEE_T_MCOL, IEEE_T_DEF,
++      IEEE_T_LCOL, IEEE_T_EXCOL, IEEE_T_MACERR, IEEE_T_CSERR, IEEE_T_SQE,
++      IEEE_T_FDXFC, IEEE_T_OCTETS_OK,
++      RMON_R_PACKETS, RMON_R_BC_PKT, RMON_R_MC_PKT, RMON_R_CRC_ALIGN,
++      RMON_R_UNDERSIZE, RMON_R_OVERSIZE, RMON_R_FRAG, RMON_R_JAB,
++      RMON_R_RESVD_O, RMON_R_P64, RMON_R_P65TO127, RMON_R_P128TO255,
++      RMON_R_P256TO511, RMON_R_P512TO1023, RMON_R_P1024TO2047,
++      RMON_R_P_GTE2048, RMON_R_OCTETS,
++      IEEE_R_DROP, IEEE_R_FRAME_OK, IEEE_R_CRC, IEEE_R_ALIGN, IEEE_R_MACERR,
++      IEEE_R_FDXFC, IEEE_R_OCTETS_OK
++};
+ #else
+ static __u32 fec_enet_register_version = 1;
+ static u32 fec_enet_register_offset[] = {
+@@ -2360,7 +2385,24 @@ static void fec_enet_get_regs(struct net_device *ndev,
+       u32 *buf = (u32 *)regbuf;
+       u32 i, off;
+       int ret;
++#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
++      defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
++      defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
++      u32 *reg_list;
++      u32 reg_cnt;
++      if (!of_machine_is_compatible("fsl,imx6ul")) {
++              reg_list = fec_enet_register_offset;
++              reg_cnt = ARRAY_SIZE(fec_enet_register_offset);
++      } else {
++              reg_list = fec_enet_register_offset_6ul;
++              reg_cnt = ARRAY_SIZE(fec_enet_register_offset_6ul);
++      }
++#else
++      /* coldfire */
++      static u32 *reg_list = fec_enet_register_offset;
++      static const u32 reg_cnt = ARRAY_SIZE(fec_enet_register_offset);
++#endif
+       ret = pm_runtime_resume_and_get(dev);
+       if (ret < 0)
+               return;
+@@ -2369,8 +2411,8 @@ static void fec_enet_get_regs(struct net_device *ndev,
+       memset(buf, 0, regs->len);
+-      for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {
+-              off = fec_enet_register_offset[i];
++      for (i = 0; i < reg_cnt; i++) {
++              off = reg_list[i];
+               if ((off == FEC_R_BOUND || off == FEC_R_FSTART) &&
+                   !(fep->quirks & FEC_QUIRK_HAS_FRREG))
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch b/queue-5.15/net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch
new file mode 100644 (file)
index 0000000..4318cbc
--- /dev/null
@@ -0,0 +1,121 @@
+From c1e566e396c86513290eac22afae790c1ede5ddf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 10:42:13 +0800
+Subject: net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit d266935ac43d57586e311a087510fe6a084af742 ]
+
+When the ops_init() interface is invoked to initialize the net, but
+ops->init() fails, data is released. However, the ptr pointer in
+net->gen is invalid. In this case, when nfqnl_nf_hook_drop() is invoked
+to release the net, invalid address access occurs.
+
+The process is as follows:
+setup_net()
+       ops_init()
+               data = kzalloc(...)   ---> alloc "data"
+               net_assign_generic()  ---> assign "date" to ptr in net->gen
+               ...
+               ops->init()           ---> failed
+               ...
+               kfree(data);          ---> ptr in net->gen is invalid
+       ...
+       ops_exit_list()
+               ...
+               nfqnl_nf_hook_drop()
+                       *q = nfnl_queue_pernet(net) ---> q is invalid
+
+The following is the Call Trace information:
+BUG: KASAN: use-after-free in nfqnl_nf_hook_drop+0x264/0x280
+Read of size 8 at addr ffff88810396b240 by task ip/15855
+Call Trace:
+<TASK>
+dump_stack_lvl+0x8e/0xd1
+print_report+0x155/0x454
+kasan_report+0xba/0x1f0
+nfqnl_nf_hook_drop+0x264/0x280
+nf_queue_nf_hook_drop+0x8b/0x1b0
+__nf_unregister_net_hook+0x1ae/0x5a0
+nf_unregister_net_hooks+0xde/0x130
+ops_exit_list+0xb0/0x170
+setup_net+0x7ac/0xbd0
+copy_net_ns+0x2e6/0x6b0
+create_new_namespaces+0x382/0xa50
+unshare_nsproxy_namespaces+0xa6/0x1c0
+ksys_unshare+0x3a4/0x7e0
+__x64_sys_unshare+0x2d/0x40
+do_syscall_64+0x35/0x80
+entry_SYSCALL_64_after_hwframe+0x46/0xb0
+</TASK>
+
+Allocated by task 15855:
+kasan_save_stack+0x1e/0x40
+kasan_set_track+0x21/0x30
+__kasan_kmalloc+0xa1/0xb0
+__kmalloc+0x49/0xb0
+ops_init+0xe7/0x410
+setup_net+0x5aa/0xbd0
+copy_net_ns+0x2e6/0x6b0
+create_new_namespaces+0x382/0xa50
+unshare_nsproxy_namespaces+0xa6/0x1c0
+ksys_unshare+0x3a4/0x7e0
+__x64_sys_unshare+0x2d/0x40
+do_syscall_64+0x35/0x80
+entry_SYSCALL_64_after_hwframe+0x46/0xb0
+
+Freed by task 15855:
+kasan_save_stack+0x1e/0x40
+kasan_set_track+0x21/0x30
+kasan_save_free_info+0x2a/0x40
+____kasan_slab_free+0x155/0x1b0
+slab_free_freelist_hook+0x11b/0x220
+__kmem_cache_free+0xa4/0x360
+ops_init+0xb9/0x410
+setup_net+0x5aa/0xbd0
+copy_net_ns+0x2e6/0x6b0
+create_new_namespaces+0x382/0xa50
+unshare_nsproxy_namespaces+0xa6/0x1c0
+ksys_unshare+0x3a4/0x7e0
+__x64_sys_unshare+0x2d/0x40
+do_syscall_64+0x35/0x80
+entry_SYSCALL_64_after_hwframe+0x46/0xb0
+
+Fixes: f875bae06533 ("net: Automatically allocate per namespace data.")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/net_namespace.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
+index 9745cb6fdf51..982d06332007 100644
+--- a/net/core/net_namespace.c
++++ b/net/core/net_namespace.c
+@@ -117,6 +117,7 @@ static int net_assign_generic(struct net *net, unsigned int id, void *data)
+ static int ops_init(const struct pernet_operations *ops, struct net *net)
+ {
++      struct net_generic *ng;
+       int err = -ENOMEM;
+       void *data = NULL;
+@@ -135,7 +136,13 @@ static int ops_init(const struct pernet_operations *ops, struct net *net)
+       if (!err)
+               return 0;
++      if (ops->id && ops->size) {
+ cleanup:
++              ng = rcu_dereference_protected(net->gen,
++                                             lockdep_is_held(&pernet_ops_rwsem));
++              ng->ptr[*ops->id] = NULL;
++      }
++
+       kfree(data);
+ out:
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-hinic-fix-incorrect-assignment-issue-in-hinic_se.patch b/queue-5.15/net-hinic-fix-incorrect-assignment-issue-in-hinic_se.patch
new file mode 100644 (file)
index 0000000..cc97039
--- /dev/null
@@ -0,0 +1,36 @@
+From 422602590950388141c25cc645b802f84fe4a3ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 17:57:51 +0800
+Subject: net: hinic: fix incorrect assignment issue in
+ hinic_set_interrupt_cfg()
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit c0605cd6750f2db9890c43a91ea4d77be8fb4908 ]
+
+The value of lli_credit_cnt is incorrectly assigned, fix it.
+
+Fixes: a0337c0dee68 ("hinic: add support to set and get irq coalesce")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
+index ca76896d9f1c..8b04d133b3c4 100644
+--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
++++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c
+@@ -892,7 +892,7 @@ int hinic_set_interrupt_cfg(struct hinic_hwdev *hwdev,
+       if (err)
+               return -EINVAL;
+-      interrupt_info->lli_credit_cnt = temp_info.lli_timer_cnt;
++      interrupt_info->lli_credit_cnt = temp_info.lli_credit_cnt;
+       interrupt_info->lli_timer_cnt = temp_info.lli_timer_cnt;
+       err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_COMM,
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-hinic-fix-memory-leak-when-reading-function-tabl.patch b/queue-5.15/net-hinic-fix-memory-leak-when-reading-function-tabl.patch
new file mode 100644 (file)
index 0000000..a4b940c
--- /dev/null
@@ -0,0 +1,67 @@
+From 2faf8664bc9e3825a2f65ba2d8b8440e9ef52b02 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 17:57:52 +0800
+Subject: net: hinic: fix memory leak when reading function table
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit 4c1f602df8956bc0decdafd7e4fc7eef50c550b1 ]
+
+When the input parameter idx meets the expected case option in
+hinic_dbg_get_func_table(), read_data is not released. Fix it.
+
+Fixes: 5215e16244ee ("hinic: add support to query function table")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/huawei/hinic/hinic_debugfs.c  | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c b/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
+index 19eb839177ec..061952c6c21a 100644
+--- a/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
++++ b/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c
+@@ -85,6 +85,7 @@ static int hinic_dbg_get_func_table(struct hinic_dev *nic_dev, int idx)
+       struct tag_sml_funcfg_tbl *funcfg_table_elem;
+       struct hinic_cmd_lt_rd *read_data;
+       u16 out_size = sizeof(*read_data);
++      int ret = ~0;
+       int err;
+       read_data = kzalloc(sizeof(*read_data), GFP_KERNEL);
+@@ -111,20 +112,25 @@ static int hinic_dbg_get_func_table(struct hinic_dev *nic_dev, int idx)
+       switch (idx) {
+       case VALID:
+-              return funcfg_table_elem->dw0.bs.valid;
++              ret = funcfg_table_elem->dw0.bs.valid;
++              break;
+       case RX_MODE:
+-              return funcfg_table_elem->dw0.bs.nic_rx_mode;
++              ret = funcfg_table_elem->dw0.bs.nic_rx_mode;
++              break;
+       case MTU:
+-              return funcfg_table_elem->dw1.bs.mtu;
++              ret = funcfg_table_elem->dw1.bs.mtu;
++              break;
+       case RQ_DEPTH:
+-              return funcfg_table_elem->dw13.bs.cfg_rq_depth;
++              ret = funcfg_table_elem->dw13.bs.cfg_rq_depth;
++              break;
+       case QUEUE_NUM:
+-              return funcfg_table_elem->dw13.bs.cfg_q_num;
++              ret = funcfg_table_elem->dw13.bs.cfg_q_num;
++              break;
+       }
+       kfree(read_data);
+-      return ~0;
++      return ret;
+ }
+ static ssize_t hinic_dbg_cmd_read(struct file *filp, char __user *buffer, size_t count,
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-hinic-fix-the-issue-of-cmdq-memory-leaks.patch b/queue-5.15/net-hinic-fix-the-issue-of-cmdq-memory-leaks.patch
new file mode 100644 (file)
index 0000000..49ef625
--- /dev/null
@@ -0,0 +1,36 @@
+From 5ee902fa82ae7ee0d574bdbdb8070e3be3ebaf6d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 17:57:53 +0800
+Subject: net: hinic: fix the issue of CMDQ memory leaks
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit 363cc87767f6ddcfb9158ad2e2afa2f8d5c4b94e ]
+
+When hinic_set_cmdq_depth() fails in hinic_init_cmdqs(), the cmdq memory is
+not released correctly. Fix it.
+
+Fixes: 72ef908bb3ff ("hinic: add three net_device_ops of vf")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
+index a627237f694b..afa816cfcdf4 100644
+--- a/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
++++ b/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c
+@@ -929,7 +929,7 @@ int hinic_init_cmdqs(struct hinic_cmdqs *cmdqs, struct hinic_hwif *hwif,
+ err_set_cmdq_depth:
+       hinic_ceq_unregister_cb(&func_to_io->ceqs, HINIC_CEQ_CMDQ);
+-
++      free_cmdq(&cmdqs->cmdq[HINIC_CMDQ_SYNC]);
+ err_cmdq_ctxt:
+       hinic_wqs_cmdq_free(&cmdqs->cmdq_pages, cmdqs->saved_wqs,
+                           HINIC_MAX_CMDQ_TYPES);
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-hinic-fix-the-issue-of-double-release-mbox-callb.patch b/queue-5.15/net-hinic-fix-the-issue-of-double-release-mbox-callb.patch
new file mode 100644 (file)
index 0000000..afe7234
--- /dev/null
@@ -0,0 +1,36 @@
+From 5984587840eebc5c2fa03fd26b515917bb6de0bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 17:57:54 +0800
+Subject: net: hinic: fix the issue of double release MBOX callback of VF
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit 8ec2f4c6b2e11a4249bba77460f0cfe6d95a82f8 ]
+
+In hinic_vf_func_init(), if VF fails to register information with PF
+through the MBOX, the MBOX callback function of VF is released once. But
+it is released again in hinic_init_hwdev(). Remove one.
+
+Fixes: 7dd29ee12865 ("hinic: add sriov feature support")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+index a78c398bf5b2..e81a7b28209b 100644
+--- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
++++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+@@ -1180,7 +1180,6 @@ int hinic_vf_func_init(struct hinic_hwdev *hwdev)
+                       dev_err(&hwdev->hwif->pdev->dev,
+                               "Failed to register VF, err: %d, status: 0x%x, out size: 0x%x\n",
+                               err, register_info.status, out_size);
+-                      hinic_unregister_vf_mbox_cb(hwdev, HINIC_MOD_L2NIC);
+                       return -EIO;
+               }
+       } else {
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-ksz884x-fix-missing-pci_disable_device-on-error-.patch b/queue-5.15/net-ksz884x-fix-missing-pci_disable_device-on-error-.patch
new file mode 100644 (file)
index 0000000..d241edc
--- /dev/null
@@ -0,0 +1,39 @@
+From 84e6f9e36ec797e6ce05a42b1cfd8ee794760d32 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Oct 2022 21:13:38 +0800
+Subject: net: ksz884x: fix missing pci_disable_device() on error in
+ pcidev_init()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 5da6d65590a0698199df44d095e54b0ed1708178 ]
+
+pci_disable_device() need be called while module exiting, switch to use
+pcim_enable(), pci_disable_device() will be called in pcim_release()
+while unbinding device.
+
+Fixes: 8ca86fd83eae ("net: Micrel KSZ8841/2 PCI Ethernet driver")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221024131338.2848959-1-yangyingliang@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/micrel/ksz884x.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
+index a0ee155f9f51..f56bcd3e36d2 100644
+--- a/drivers/net/ethernet/micrel/ksz884x.c
++++ b/drivers/net/ethernet/micrel/ksz884x.c
+@@ -6848,7 +6848,7 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id)
+       char banner[sizeof(version)];
+       struct ksz_switch *sw = NULL;
+-      result = pci_enable_device(pdev);
++      result = pcim_enable_device(pdev);
+       if (result)
+               return result;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch b/queue-5.15/net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch
new file mode 100644 (file)
index 0000000..49df4c2
--- /dev/null
@@ -0,0 +1,35 @@
+From ed3e2c265df35a339bcce8d2387fab4aa8b51a56 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 09:32:24 +0800
+Subject: net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY
+
+From: Zhang Changzhong <zhangchangzhong@huawei.com>
+
+[ Upstream commit 9c1eaa27ec599fcc25ed4970c0b73c247d147a2b ]
+
+The ndo_start_xmit() method must not free skb when returning
+NETDEV_TX_BUSY, since caller is going to requeue freed skb.
+
+Fixes: 504d4721ee8e ("MIPS: Lantiq: Add ethernet driver")
+Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/lantiq_etop.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
+index 62f8c5212182..057d655d1769 100644
+--- a/drivers/net/ethernet/lantiq_etop.c
++++ b/drivers/net/ethernet/lantiq_etop.c
+@@ -466,7 +466,6 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
+       len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
+       if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
+-              dev_kfree_skb_any(skb);
+               netdev_err(dev, "tx ring full\n");
+               netif_tx_stop_queue(txq);
+               return NETDEV_TX_BUSY;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-macb-specify-phy-pm-management-done-by-mac.patch b/queue-5.15/net-macb-specify-phy-pm-management-done-by-mac.patch
new file mode 100644 (file)
index 0000000..81ab40e
--- /dev/null
@@ -0,0 +1,44 @@
+From 03ea882bfba844e548a5e596bccbdddff70d44b2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 15:09:32 +0300
+Subject: net: macb: Specify PHY PM management done by MAC
+
+From: Sergiu Moga <sergiu.moga@microchip.com>
+
+[ Upstream commit 15a9dbec631cd69dfbbfc4e2cbf90c9dd8432a8f ]
+
+The `macb_resume`/`macb_suspend` methods already call the
+`phylink_start`/`phylink_stop` methods during their execution so
+explicitly say that the PM of the PHY is done by MAC by using the
+`mac_managed_pm` flag of the `struct phylink_config`.
+
+This also fixes the warning message issued during resume:
+WARNING: CPU: 0 PID: 237 at drivers/net/phy/phy_device.c:323 mdio_bus_phy_resume+0x144/0x148
+
+Depends-on: 96de900ae78e ("net: phylink: add mac_managed_pm in phylink_config structure")
+Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state")
+Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
+Link: https://lore.kernel.org/r/20221019120929.63098-1-sergiu.moga@microchip.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/cadence/macb_main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
+index 3ca3f9d0fd9b..61efb2350412 100644
+--- a/drivers/net/ethernet/cadence/macb_main.c
++++ b/drivers/net/ethernet/cadence/macb_main.c
+@@ -880,6 +880,7 @@ static int macb_mii_probe(struct net_device *dev)
+       bp->phylink_config.dev = &dev->dev;
+       bp->phylink_config.type = PHYLINK_NETDEV;
++      bp->phylink_config.mac_managed_pm = true;
+       if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII) {
+               bp->phylink_config.poll_fixed_state = true;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-memcg-avoid-stalls-when-under-memory-pressure.patch b/queue-5.15/net-memcg-avoid-stalls-when-under-memory-pressure.patch
new file mode 100644 (file)
index 0000000..3cb4dca
--- /dev/null
@@ -0,0 +1,59 @@
+From 7422ec0370a643307810a928b157b87403bc9123 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 09:03:04 -0700
+Subject: net-memcg: avoid stalls when under memory pressure
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 720ca52bcef225b967a339e0fffb6d0c7e962240 ]
+
+As Shakeel explains the commit under Fixes had the unintended
+side-effect of no longer pre-loading the cached memory allowance.
+Even tho we previously dropped the first packet received when
+over memory limit - the consecutive ones would get thru by using
+the cache. The charging was happening in batches of 128kB, so
+we'd let in 128kB (truesize) worth of packets per one drop.
+
+After the change we no longer force charge, there will be no
+cache filling side effects. This causes significant drops and
+connection stalls for workloads which use a lot of page cache,
+since we can't reclaim page cache under GFP_NOWAIT.
+
+Some of the latency can be recovered by improving SACK reneg
+handling but nowhere near enough to get back to the pre-5.15
+performance (the application I'm experimenting with still
+sees 5-10x worst latency).
+
+Apply the suggested workaround of using GFP_ATOMIC. We will now
+be more permissive than previously as we'll drop _no_ packets
+in softirq when under pressure. But I can't think of any good
+and simple way to address that within networking.
+
+Link: https://lore.kernel.org/all/20221012163300.795e7b86@kernel.org/
+Suggested-by: Shakeel Butt <shakeelb@google.com>
+Fixes: 4b1327be9fe5 ("net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem()")
+Acked-by: Shakeel Butt <shakeelb@google.com>
+Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
+Link: https://lore.kernel.org/r/20221021160304.1362511-1-kuba@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/sock.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/net/sock.h b/include/net/sock.h
+index cb1a1bb64ed8..e1a303e4f0f7 100644
+--- a/include/net/sock.h
++++ b/include/net/sock.h
+@@ -2472,7 +2472,7 @@ static inline gfp_t gfp_any(void)
+ static inline gfp_t gfp_memcg_charge(void)
+ {
+-      return in_softirq() ? GFP_NOWAIT : GFP_KERNEL;
++      return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
+ }
+ static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-mlx5-fix-crash-during-sync-firmware-reset.patch b/queue-5.15/net-mlx5-fix-crash-during-sync-firmware-reset.patch
new file mode 100644 (file)
index 0000000..f618096
--- /dev/null
@@ -0,0 +1,62 @@
+From 43730a4699d04033a8e64d48878f695b2875efbd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Oct 2022 14:51:49 +0100
+Subject: net/mlx5: Fix crash during sync firmware reset
+
+From: Suresh Devarakonda <ramad@nvidia.com>
+
+[ Upstream commit aefb62a9988749703435e941704624949a80a2a9 ]
+
+When setting Bluefield to DPU NIC mode using mlxconfig tool +  sync
+firmware reset flow, we run into scenario where the host was not
+eswitch manager at the time of mlx5 driver load but becomes eswitch manager
+after the sync firmware reset flow. This results in null pointer
+access of mpfs structure during mac filter add. This change prevents null
+pointer access but mpfs table entries will not be added.
+
+Fixes: 5ec697446f46 ("net/mlx5: Add support for devlink reload action fw activate")
+Signed-off-by: Suresh Devarakonda <ramad@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Reviewed-by: Bodong Wang <bodong@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Link: https://lore.kernel.org/r/20221026135153.154807-12-saeed@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
+index 839a01da110f..8ff16318e32d 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
+@@ -122,7 +122,7 @@ void mlx5_mpfs_cleanup(struct mlx5_core_dev *dev)
+ {
+       struct mlx5_mpfs *mpfs = dev->priv.mpfs;
+-      if (!MLX5_ESWITCH_MANAGER(dev))
++      if (!mpfs)
+               return;
+       WARN_ON(!hlist_empty(mpfs->hash));
+@@ -137,7 +137,7 @@ int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac)
+       int err = 0;
+       u32 index;
+-      if (!MLX5_ESWITCH_MANAGER(dev))
++      if (!mpfs)
+               return 0;
+       mutex_lock(&mpfs->lock);
+@@ -185,7 +185,7 @@ int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac)
+       int err = 0;
+       u32 index;
+-      if (!MLX5_ESWITCH_MANAGER(dev))
++      if (!mpfs)
+               return 0;
+       mutex_lock(&mpfs->lock);
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-mlx5-fix-possible-use-after-free-in-async-comman.patch b/queue-5.15/net-mlx5-fix-possible-use-after-free-in-async-comman.patch
new file mode 100644 (file)
index 0000000..9bfb36c
--- /dev/null
@@ -0,0 +1,212 @@
+From 992a3d498330f42e412ee9d1f747a98a3542a242 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Oct 2022 14:51:45 +0100
+Subject: net/mlx5: Fix possible use-after-free in async command interface
+
+From: Tariq Toukan <tariqt@nvidia.com>
+
+[ Upstream commit bacd22df95147ed673bec4692ab2d4d585935241 ]
+
+mlx5_cmd_cleanup_async_ctx should return only after all its callback
+handlers were completed. Before this patch, the below race between
+mlx5_cmd_cleanup_async_ctx and mlx5_cmd_exec_cb_handler was possible and
+lead to a use-after-free:
+
+1. mlx5_cmd_cleanup_async_ctx is called while num_inflight is 2 (i.e.
+   elevated by 1, a single inflight callback).
+2. mlx5_cmd_cleanup_async_ctx decreases num_inflight to 1.
+3. mlx5_cmd_exec_cb_handler is called, decreases num_inflight to 0 and
+   is about to call wake_up().
+4. mlx5_cmd_cleanup_async_ctx calls wait_event, which returns
+   immediately as the condition (num_inflight == 0) holds.
+5. mlx5_cmd_cleanup_async_ctx returns.
+6. The caller of mlx5_cmd_cleanup_async_ctx frees the mlx5_async_ctx
+   object.
+7. mlx5_cmd_exec_cb_handler goes on and calls wake_up() on the freed
+   object.
+
+Fix it by syncing using a completion object. Mark it completed when
+num_inflight reaches 0.
+
+Trace:
+
+BUG: KASAN: use-after-free in do_raw_spin_lock+0x23d/0x270
+Read of size 4 at addr ffff888139cd12f4 by task swapper/5/0
+
+CPU: 5 PID: 0 Comm: swapper/5 Not tainted 6.0.0-rc3_for_upstream_debug_2022_08_30_13_10 #1
+Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
+Call Trace:
+ <IRQ>
+ dump_stack_lvl+0x57/0x7d
+ print_report.cold+0x2d5/0x684
+ ? do_raw_spin_lock+0x23d/0x270
+ kasan_report+0xb1/0x1a0
+ ? do_raw_spin_lock+0x23d/0x270
+ do_raw_spin_lock+0x23d/0x270
+ ? rwlock_bug.part.0+0x90/0x90
+ ? __delete_object+0xb8/0x100
+ ? lock_downgrade+0x6e0/0x6e0
+ _raw_spin_lock_irqsave+0x43/0x60
+ ? __wake_up_common_lock+0xb9/0x140
+ __wake_up_common_lock+0xb9/0x140
+ ? __wake_up_common+0x650/0x650
+ ? destroy_tis_callback+0x53/0x70 [mlx5_core]
+ ? kasan_set_track+0x21/0x30
+ ? destroy_tis_callback+0x53/0x70 [mlx5_core]
+ ? kfree+0x1ba/0x520
+ ? do_raw_spin_unlock+0x54/0x220
+ mlx5_cmd_exec_cb_handler+0x136/0x1a0 [mlx5_core]
+ ? mlx5_cmd_cleanup_async_ctx+0x220/0x220 [mlx5_core]
+ ? mlx5_cmd_cleanup_async_ctx+0x220/0x220 [mlx5_core]
+ mlx5_cmd_comp_handler+0x65a/0x12b0 [mlx5_core]
+ ? dump_command+0xcc0/0xcc0 [mlx5_core]
+ ? lockdep_hardirqs_on_prepare+0x400/0x400
+ ? cmd_comp_notifier+0x7e/0xb0 [mlx5_core]
+ cmd_comp_notifier+0x7e/0xb0 [mlx5_core]
+ atomic_notifier_call_chain+0xd7/0x1d0
+ mlx5_eq_async_int+0x3ce/0xa20 [mlx5_core]
+ atomic_notifier_call_chain+0xd7/0x1d0
+ ? irq_release+0x140/0x140 [mlx5_core]
+ irq_int_handler+0x19/0x30 [mlx5_core]
+ __handle_irq_event_percpu+0x1f2/0x620
+ handle_irq_event+0xb2/0x1d0
+ handle_edge_irq+0x21e/0xb00
+ __common_interrupt+0x79/0x1a0
+ common_interrupt+0x78/0xa0
+ </IRQ>
+ <TASK>
+ asm_common_interrupt+0x22/0x40
+RIP: 0010:default_idle+0x42/0x60
+Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 0f b6 14 11 38 d0 7c 04 84 d2 75 14 8b 05 eb 47 22 02 85 c0 7e 07 0f 00 2d e0 9f 48 00 fb f4 <c3> 48 c7 c7 80 08 7f 85 e8 d1 d3 3e fe eb de 66 66 2e 0f 1f 84 00
+RSP: 0018:ffff888100dbfdf0 EFLAGS: 00000242
+RAX: 0000000000000001 RBX: ffffffff84ecbd48 RCX: 1ffffffff0afe110
+RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffff835cc9bc
+RBP: 0000000000000005 R08: 0000000000000001 R09: ffff88881dec4ac3
+R10: ffffed1103bd8958 R11: 0000017d0ca571c9 R12: 0000000000000005
+R13: ffffffff84f024e0 R14: 0000000000000000 R15: dffffc0000000000
+ ? default_idle_call+0xcc/0x450
+ default_idle_call+0xec/0x450
+ do_idle+0x394/0x450
+ ? arch_cpu_idle_exit+0x40/0x40
+ ? do_idle+0x17/0x450
+ cpu_startup_entry+0x19/0x20
+ start_secondary+0x221/0x2b0
+ ? set_cpu_sibling_map+0x2070/0x2070
+ secondary_startup_64_no_verify+0xcd/0xdb
+ </TASK>
+
+Allocated by task 49502:
+ kasan_save_stack+0x1e/0x40
+ __kasan_kmalloc+0x81/0xa0
+ kvmalloc_node+0x48/0xe0
+ mlx5e_bulk_async_init+0x35/0x110 [mlx5_core]
+ mlx5e_tls_priv_tx_list_cleanup+0x84/0x3e0 [mlx5_core]
+ mlx5e_ktls_cleanup_tx+0x38f/0x760 [mlx5_core]
+ mlx5e_cleanup_nic_tx+0xa7/0x100 [mlx5_core]
+ mlx5e_detach_netdev+0x1ca/0x2b0 [mlx5_core]
+ mlx5e_suspend+0xdb/0x140 [mlx5_core]
+ mlx5e_remove+0x89/0x190 [mlx5_core]
+ auxiliary_bus_remove+0x52/0x70
+ device_release_driver_internal+0x40f/0x650
+ driver_detach+0xc1/0x180
+ bus_remove_driver+0x125/0x2f0
+ auxiliary_driver_unregister+0x16/0x50
+ mlx5e_cleanup+0x26/0x30 [mlx5_core]
+ cleanup+0xc/0x4e [mlx5_core]
+ __x64_sys_delete_module+0x2b5/0x450
+ do_syscall_64+0x3d/0x90
+ entry_SYSCALL_64_after_hwframe+0x46/0xb0
+
+Freed by task 49502:
+ kasan_save_stack+0x1e/0x40
+ kasan_set_track+0x21/0x30
+ kasan_set_free_info+0x20/0x30
+ ____kasan_slab_free+0x11d/0x1b0
+ kfree+0x1ba/0x520
+ mlx5e_tls_priv_tx_list_cleanup+0x2e7/0x3e0 [mlx5_core]
+ mlx5e_ktls_cleanup_tx+0x38f/0x760 [mlx5_core]
+ mlx5e_cleanup_nic_tx+0xa7/0x100 [mlx5_core]
+ mlx5e_detach_netdev+0x1ca/0x2b0 [mlx5_core]
+ mlx5e_suspend+0xdb/0x140 [mlx5_core]
+ mlx5e_remove+0x89/0x190 [mlx5_core]
+ auxiliary_bus_remove+0x52/0x70
+ device_release_driver_internal+0x40f/0x650
+ driver_detach+0xc1/0x180
+ bus_remove_driver+0x125/0x2f0
+ auxiliary_driver_unregister+0x16/0x50
+ mlx5e_cleanup+0x26/0x30 [mlx5_core]
+ cleanup+0xc/0x4e [mlx5_core]
+ __x64_sys_delete_module+0x2b5/0x450
+ do_syscall_64+0x3d/0x90
+ entry_SYSCALL_64_after_hwframe+0x46/0xb0
+
+Fixes: e355477ed9e4 ("net/mlx5: Make mlx5_cmd_exec_cb() a safe API")
+Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Link: https://lore.kernel.org/r/20221026135153.154807-8-saeed@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 10 +++++-----
+ include/linux/mlx5/driver.h                   |  2 +-
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+index e06a6104e91f..8a3100f32d3b 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+@@ -1865,7 +1865,7 @@ void mlx5_cmd_init_async_ctx(struct mlx5_core_dev *dev,
+       ctx->dev = dev;
+       /* Starts at 1 to avoid doing wake_up if we are not cleaning up */
+       atomic_set(&ctx->num_inflight, 1);
+-      init_waitqueue_head(&ctx->wait);
++      init_completion(&ctx->inflight_done);
+ }
+ EXPORT_SYMBOL(mlx5_cmd_init_async_ctx);
+@@ -1879,8 +1879,8 @@ EXPORT_SYMBOL(mlx5_cmd_init_async_ctx);
+  */
+ void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx)
+ {
+-      atomic_dec(&ctx->num_inflight);
+-      wait_event(ctx->wait, atomic_read(&ctx->num_inflight) == 0);
++      if (!atomic_dec_and_test(&ctx->num_inflight))
++              wait_for_completion(&ctx->inflight_done);
+ }
+ EXPORT_SYMBOL(mlx5_cmd_cleanup_async_ctx);
+@@ -1891,7 +1891,7 @@ static void mlx5_cmd_exec_cb_handler(int status, void *_work)
+       work->user_callback(status, work);
+       if (atomic_dec_and_test(&ctx->num_inflight))
+-              wake_up(&ctx->wait);
++              complete(&ctx->inflight_done);
+ }
+ int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
+@@ -1907,7 +1907,7 @@ int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size,
+       ret = cmd_exec(ctx->dev, in, in_size, out, out_size,
+                      mlx5_cmd_exec_cb_handler, work, false);
+       if (ret && atomic_dec_and_test(&ctx->num_inflight))
+-              wake_up(&ctx->wait);
++              complete(&ctx->inflight_done);
+       return ret;
+ }
+diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
+index 4c678de4608d..26095c0fd781 100644
+--- a/include/linux/mlx5/driver.h
++++ b/include/linux/mlx5/driver.h
+@@ -966,7 +966,7 @@ void mlx5_cmd_allowed_opcode(struct mlx5_core_dev *dev, u16 opcode);
+ struct mlx5_async_ctx {
+       struct mlx5_core_dev *dev;
+       atomic_t num_inflight;
+-      struct wait_queue_head wait;
++      struct completion inflight_done;
+ };
+ struct mlx5_async_work;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-mlx5-print-more-info-on-pci-error-handlers.patch b/queue-5.15/net-mlx5-print-more-info-on-pci-error-handlers.patch
new file mode 100644 (file)
index 0000000..92a67ce
--- /dev/null
@@ -0,0 +1,133 @@
+From 73095f2da4a1fbcf5c437f508b3a80de7a4d1deb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 4 Oct 2021 18:39:51 -0700
+Subject: net/mlx5: Print more info on pci error handlers
+
+From: Saeed Mahameed <saeedm@nvidia.com>
+
+[ Upstream commit fad1783a6d669ac82b6ea4f2f32b4ba2b5484920 ]
+
+In case mlx5_pci_err_detected was called with state equals to
+pci_channel_io_perm_failure, the driver will never come back up.
+
+It is nice to know why the driver went to zombie land, so print some
+useful information on pci err handlers.
+
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Stable-dep-of: 416ef7136319 ("net/mlx5: Update fw fatal reporter state on PCI handlers successful recover")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/mellanox/mlx5/core/main.c    | 51 ++++++++++++++-----
+ 1 file changed, 37 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
+index 740065e21181..1f0156efe255 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
+@@ -1576,12 +1576,28 @@ static void remove_one(struct pci_dev *pdev)
+       mlx5_devlink_free(devlink);
+ }
++#define mlx5_pci_trace(dev, fmt, ...) ({ \
++      struct mlx5_core_dev *__dev = (dev); \
++      mlx5_core_info(__dev, "%s Device state = %d health sensors: %d pci_status: %d. " fmt, \
++                     __func__, __dev->state, mlx5_health_check_fatal_sensors(__dev), \
++                     __dev->pci_status, ##__VA_ARGS__); \
++})
++
++static const char *result2str(enum pci_ers_result result)
++{
++      return  result == PCI_ERS_RESULT_NEED_RESET ? "need reset" :
++              result == PCI_ERS_RESULT_DISCONNECT ? "disconnect" :
++              result == PCI_ERS_RESULT_RECOVERED  ? "recovered" :
++              "unknown";
++}
++
+ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
+                                             pci_channel_state_t state)
+ {
+       struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
++      enum pci_ers_result res;
+-      mlx5_core_info(dev, "%s was called\n", __func__);
++      mlx5_pci_trace(dev, "Enter, pci channel state = %d\n", state);
+       mlx5_enter_error_state(dev, false);
+       mlx5_error_sw_reset(dev);
+@@ -1589,8 +1605,11 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
+       mlx5_drain_health_wq(dev);
+       mlx5_pci_disable_device(dev);
+-      return state == pci_channel_io_perm_failure ?
++      res = state == pci_channel_io_perm_failure ?
+               PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_NEED_RESET;
++
++      mlx5_pci_trace(dev, "Exit, result = %d, %s\n",  res, result2str(res));
++      return res;
+ }
+ /* wait for the device to show vital signs by waiting
+@@ -1624,28 +1643,34 @@ static int wait_vital(struct pci_dev *pdev)
+ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev)
+ {
++      enum pci_ers_result res = PCI_ERS_RESULT_DISCONNECT;
+       struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
+       int err;
+-      mlx5_core_info(dev, "%s was called\n", __func__);
++      mlx5_pci_trace(dev, "Enter\n");
+       err = mlx5_pci_enable_device(dev);
+       if (err) {
+               mlx5_core_err(dev, "%s: mlx5_pci_enable_device failed with error code: %d\n",
+                             __func__, err);
+-              return PCI_ERS_RESULT_DISCONNECT;
++              goto out;
+       }
+       pci_set_master(pdev);
+       pci_restore_state(pdev);
+       pci_save_state(pdev);
+-      if (wait_vital(pdev)) {
+-              mlx5_core_err(dev, "%s: wait_vital timed out\n", __func__);
+-              return PCI_ERS_RESULT_DISCONNECT;
++      err = wait_vital(pdev);
++      if (err) {
++              mlx5_core_err(dev, "%s: wait vital failed with error code: %d\n",
++                            __func__, err);
++              goto out;
+       }
+-      return PCI_ERS_RESULT_RECOVERED;
++      res = PCI_ERS_RESULT_RECOVERED;
++out:
++      mlx5_pci_trace(dev, "Exit, err = %d, result = %d, %s\n", err, res, result2str(res));
++      return res;
+ }
+ static void mlx5_pci_resume(struct pci_dev *pdev)
+@@ -1653,14 +1678,12 @@ static void mlx5_pci_resume(struct pci_dev *pdev)
+       struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
+       int err;
+-      mlx5_core_info(dev, "%s was called\n", __func__);
++      mlx5_pci_trace(dev, "Enter, loading driver..\n");
+       err = mlx5_load_one(dev);
+-      if (err)
+-              mlx5_core_err(dev, "%s: mlx5_load_one failed with error code: %d\n",
+-                            __func__, err);
+-      else
+-              mlx5_core_info(dev, "%s: device recovered\n", __func__);
++
++      mlx5_pci_trace(dev, "Done, err = %d, device %s\n", err,
++                     !err ? "recovered" : "Failed");
+ }
+ static const struct pci_error_handlers mlx5_err_handler = {
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-mlx5-update-fw-fatal-reporter-state-on-pci-handl.patch b/queue-5.15/net-mlx5-update-fw-fatal-reporter-state-on-pci-handl.patch
new file mode 100644 (file)
index 0000000..d50ad6d
--- /dev/null
@@ -0,0 +1,49 @@
+From dd71c4b381cf29c6fdcdfb5d62af8ae07d38a05f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Oct 2022 14:51:48 +0100
+Subject: net/mlx5: Update fw fatal reporter state on PCI handlers successful
+ recover
+
+From: Roy Novich <royno@nvidia.com>
+
+[ Upstream commit 416ef713631937cf5452476a7f1041a3ae7b06c6 ]
+
+Update devlink health fw fatal reporter state to "healthy" is needed by
+strictly calling devlink_health_reporter_state_update() after recovery
+was done by PCI error handler. This is needed when fw_fatal reporter was
+triggered due to PCI error. Poll health is called and set reporter state
+to error. Health recovery failed (since EEH didn't re-enable the PCI).
+PCI handlers keep on recover flow and succeed later without devlink
+acknowledgment. Fix this by adding devlink state update at the end of
+the PCI handler recovery process.
+
+Fixes: 6181e5cb752e ("devlink: add support for reporter recovery completion")
+Signed-off-by: Roy Novich <royno@nvidia.com>
+Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
+Reviewed-by: Aya Levin <ayal@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Link: https://lore.kernel.org/r/20221026135153.154807-11-saeed@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
+index 1f0156efe255..d092261e96c3 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
+@@ -1682,6 +1682,10 @@ static void mlx5_pci_resume(struct pci_dev *pdev)
+       err = mlx5_load_one(dev);
++      if (!err)
++              devlink_health_reporter_state_update(dev->priv.health.fw_fatal_reporter,
++                                                   DEVLINK_HEALTH_REPORTER_STATE_HEALTHY);
++
+       mlx5_pci_trace(dev, "Done, err = %d, device %s\n", err,
+                      !err ? "recovered" : "Failed");
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-mlx5e-do-not-increment-esn-when-updating-ipsec-e.patch b/queue-5.15/net-mlx5e-do-not-increment-esn-when-updating-ipsec-e.patch
new file mode 100644 (file)
index 0000000..b8729ba
--- /dev/null
@@ -0,0 +1,75 @@
+From 9517cd0f9417a2e4dc9bdfaf6fdd8d7ab933ef4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Oct 2022 14:51:39 +0100
+Subject: net/mlx5e: Do not increment ESN when updating IPsec ESN state
+
+From: Hyong Youb Kim <hyonkim@cisco.com>
+
+[ Upstream commit 888be6b279b7257b5f6e4c9527675bff0a335596 ]
+
+An offloaded SA stops receiving after about 2^32 + replay_window
+packets. For example, when SA reaches <seq-hi 0x1, seq 0x2c>, all
+subsequent packets get dropped with SA-icv-failure (integrity_failed).
+
+To reproduce the bug:
+- ConnectX-6 Dx with crypto enabled (FW 22.30.1004)
+- ipsec.conf:
+  nic-offload = yes
+  replay-window = 32
+  esn = yes
+  salifetime=24h
+- Run netperf for a long time to send more than 2^32 packets
+  netperf -H <device-under-test> -t TCP_STREAM -l 20000
+
+When 2^32 + replay_window packets are received, the replay window
+moves from the 2nd half of subspace (overlap=1) to the 1st half
+(overlap=0). The driver then updates the 'esn' value in NIC
+(i.e. seq_hi) as follows.
+
+ seq_hi = xfrm_replay_seqhi(seq_bottom)
+ new esn in NIC = seq_hi + 1
+
+The +1 increment is wrong, as seq_hi already contains the correct
+seq_hi. For example, when seq_hi=1, the driver actually tells NIC to
+use seq_hi=2 (esn). This incorrect esn value causes all subsequent
+packets to fail integrity checks (SA-icv-failure). So, do not
+increment.
+
+Fixes: cb01008390bb ("net/mlx5: IPSec, Add support for ESN")
+Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
+Acked-by: Leon Romanovsky <leonro@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Link: https://lore.kernel.org/r/20221026135153.154807-2-saeed@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+index 7cab08a2f715..05882d1a4407 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+@@ -113,7 +113,6 @@ static bool mlx5e_ipsec_update_esn_state(struct mlx5e_ipsec_sa_entry *sa_entry)
+       struct xfrm_replay_state_esn *replay_esn;
+       u32 seq_bottom = 0;
+       u8 overlap;
+-      u32 *esn;
+       if (!(sa_entry->x->props.flags & XFRM_STATE_ESN)) {
+               sa_entry->esn_state.trigger = 0;
+@@ -128,11 +127,9 @@ static bool mlx5e_ipsec_update_esn_state(struct mlx5e_ipsec_sa_entry *sa_entry)
+       sa_entry->esn_state.esn = xfrm_replay_seqhi(sa_entry->x,
+                                                   htonl(seq_bottom));
+-      esn = &sa_entry->esn_state.esn;
+       sa_entry->esn_state.trigger = 1;
+       if (unlikely(overlap && seq_bottom < MLX5E_IPSEC_ESN_SCOPE_MID)) {
+-              ++(*esn);
+               sa_entry->esn_state.overlap = 0;
+               return true;
+       } else if (unlikely(!overlap &&
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-mlx5e-extend-skb-room-check-to-include-ptp-sq.patch b/queue-5.15/net-mlx5e-extend-skb-room-check-to-include-ptp-sq.patch
new file mode 100644 (file)
index 0000000..b851591
--- /dev/null
@@ -0,0 +1,102 @@
+From 8bef65a166f6e2b1236960e0692eed3a327c5e1e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Oct 2022 14:51:42 +0100
+Subject: net/mlx5e: Extend SKB room check to include PTP-SQ
+
+From: Aya Levin <ayal@nvidia.com>
+
+[ Upstream commit 19b43a432e3e47db656a8269a74b50aef826950c ]
+
+When tx_port_ts is set, the driver diverts all UPD traffic over PTP port
+to a dedicated PTP-SQ. The SKBs are cached until the wire-CQE arrives.
+When the packet size is greater then MTU, the firmware might drop it and
+the packet won't be transmitted to the wire, hence the wire-CQE won't
+reach the driver. In this case the SKBs are accumulated in the SKB fifo.
+Add room check to consider the PTP-SQ SKB fifo, when the SKB fifo is
+full, driver stops the queue resulting in a TX timeout. Devlink
+TX-reporter can recover from it.
+
+Fixes: 1880bc4e4a96 ("net/mlx5e: Add TX port timestamp support")
+Signed-off-by: Aya Levin <ayal@nvidia.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Link: https://lore.kernel.org/r/20221026135153.154807-5-saeed@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h  | 9 +++++++++
+ drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 6 ++++++
+ drivers/net/ethernet/mellanox/mlx5/core/en_tx.c   | 6 ++++++
+ 3 files changed, 21 insertions(+)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h
+index a71a32e00ebb..dc7c57e6de77 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h
+@@ -6,6 +6,7 @@
+ #include "en.h"
+ #include "en_stats.h"
++#include "en/txrx.h"
+ #include <linux/ptp_classify.h>
+ #define MLX5E_PTP_CHANNEL_IX 0
+@@ -67,6 +68,14 @@ static inline bool mlx5e_use_ptpsq(struct sk_buff *skb)
+               fk.ports.dst == htons(PTP_EV_PORT));
+ }
++static inline bool mlx5e_ptpsq_fifo_has_room(struct mlx5e_txqsq *sq)
++{
++      if (!sq->ptpsq)
++              return true;
++
++      return mlx5e_skb_fifo_has_room(&sq->ptpsq->skb_fifo);
++}
++
+ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
+                  u8 lag_port, struct mlx5e_ptp **cp);
+ void mlx5e_ptp_close(struct mlx5e_ptp *c);
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
+index 055c3bc23733..f5c872043bcb 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
+@@ -73,6 +73,12 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev);
+ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget);
+ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq);
++static inline bool
++mlx5e_skb_fifo_has_room(struct mlx5e_skb_fifo *fifo)
++{
++      return (*fifo->pc - *fifo->cc) < fifo->mask;
++}
++
+ static inline bool
+ mlx5e_wqc_has_room_for(struct mlx5_wq_cyc *wq, u16 cc, u16 pc, u16 n)
+ {
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+index 1544d4c2c636..e18fa5ae0fd8 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+@@ -479,6 +479,11 @@ mlx5e_txwqe_complete(struct mlx5e_txqsq *sq, struct sk_buff *skb,
+       if (unlikely(sq->ptpsq)) {
+               mlx5e_skb_cb_hwtstamp_init(skb);
+               mlx5e_skb_fifo_push(&sq->ptpsq->skb_fifo, skb);
++              if (!netif_tx_queue_stopped(sq->txq) &&
++                  !mlx5e_skb_fifo_has_room(&sq->ptpsq->skb_fifo)) {
++                      netif_tx_stop_queue(sq->txq);
++                      sq->stats->stopped++;
++              }
+               skb_get(skb);
+       }
+@@ -906,6 +911,7 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
+       if (netif_tx_queue_stopped(sq->txq) &&
+           mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, sq->stop_room) &&
++          mlx5e_ptpsq_fifo_has_room(sq) &&
+           !test_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) {
+               netif_tx_wake_queue(sq->txq);
+               stats->wake++;
+-- 
+2.35.1
+
diff --git a/queue-5.15/net-netsec-fix-error-handling-in-netsec_register_mdi.patch b/queue-5.15/net-netsec-fix-error-handling-in-netsec_register_mdi.patch
new file mode 100644 (file)
index 0000000..124ce1a
--- /dev/null
@@ -0,0 +1,46 @@
+From cd6f73f5765009459d8394589942a7f3a7fa02a0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Oct 2022 14:41:04 +0800
+Subject: net: netsec: fix error handling in netsec_register_mdio()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+[ Upstream commit 94423589689124e8cd145b38a1034be7f25835b2 ]
+
+If phy_device_register() fails, phy_device_free() need be called to
+put refcount, so memory of phy device and device name can be freed
+in callback function.
+
+If get_phy_device() fails, mdiobus_unregister() need be called,
+or it will cause warning in mdiobus_free() and kobject is leaked.
+
+Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver")
+Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
+Link: https://lore.kernel.org/r/20221019064104.3228892-1-yangyingliang@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/socionext/netsec.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
+index 1f46af136aa8..f0451911ab8f 100644
+--- a/drivers/net/ethernet/socionext/netsec.c
++++ b/drivers/net/ethernet/socionext/netsec.c
+@@ -1964,11 +1964,13 @@ static int netsec_register_mdio(struct netsec_priv *priv, u32 phy_addr)
+                       ret = PTR_ERR(priv->phydev);
+                       dev_err(priv->dev, "get_phy_device err(%d)\n", ret);
+                       priv->phydev = NULL;
++                      mdiobus_unregister(bus);
+                       return -ENODEV;
+               }
+               ret = phy_device_register(priv->phydev);
+               if (ret) {
++                      phy_device_free(priv->phydev);
+                       mdiobus_unregister(bus);
+                       dev_err(priv->dev,
+                               "phy_device_register err(%d)\n", ret);
+-- 
+2.35.1
+
diff --git a/queue-5.15/netdevsim-remove-dir-in-nsim_dev_debugfs_init-when-c.patch b/queue-5.15/netdevsim-remove-dir-in-nsim_dev_debugfs_init-when-c.patch
new file mode 100644 (file)
index 0000000..47023db
--- /dev/null
@@ -0,0 +1,63 @@
+From 72168e4f78257aff31422c6ca14d34f53a4f6bdd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Oct 2022 09:46:42 +0800
+Subject: netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports
+ dir failed
+
+From: Zhengchao Shao <shaozhengchao@huawei.com>
+
+[ Upstream commit a6aa8d0ce2cfba57ac0f23293fcb3be0b9f53fba ]
+
+Remove dir in nsim_dev_debugfs_init() when creating ports dir failed.
+Otherwise, the netdevsim device will not be created next time. Kernel
+reports an error: debugfs: Directory 'netdevsim1' with parent 'netdevsim'
+already present!
+
+Fixes: ab1d0cc004d7 ("netdevsim: change debugfs tree topology")
+Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/netdevsim/dev.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c
+index 54313bd57797..94490dfae656 100644
+--- a/drivers/net/netdevsim/dev.c
++++ b/drivers/net/netdevsim/dev.c
+@@ -229,8 +229,10 @@ static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
+       if (IS_ERR(nsim_dev->ddir))
+               return PTR_ERR(nsim_dev->ddir);
+       nsim_dev->ports_ddir = debugfs_create_dir("ports", nsim_dev->ddir);
+-      if (IS_ERR(nsim_dev->ports_ddir))
+-              return PTR_ERR(nsim_dev->ports_ddir);
++      if (IS_ERR(nsim_dev->ports_ddir)) {
++              err = PTR_ERR(nsim_dev->ports_ddir);
++              goto err_ddir;
++      }
+       debugfs_create_bool("fw_update_status", 0600, nsim_dev->ddir,
+                           &nsim_dev->fw_update_status);
+       debugfs_create_u32("fw_update_overwrite_mask", 0600, nsim_dev->ddir,
+@@ -267,7 +269,7 @@ static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
+       nsim_dev->nodes_ddir = debugfs_create_dir("rate_nodes", nsim_dev->ddir);
+       if (IS_ERR(nsim_dev->nodes_ddir)) {
+               err = PTR_ERR(nsim_dev->nodes_ddir);
+-              goto err_out;
++              goto err_ports_ddir;
+       }
+       debugfs_create_bool("fail_trap_drop_counter_get", 0600,
+                           nsim_dev->ddir,
+@@ -275,8 +277,9 @@ static int nsim_dev_debugfs_init(struct nsim_dev *nsim_dev)
+       nsim_udp_tunnels_debugfs_create(nsim_dev);
+       return 0;
+-err_out:
++err_ports_ddir:
+       debugfs_remove_recursive(nsim_dev->ports_ddir);
++err_ddir:
+       debugfs_remove_recursive(nsim_dev->ddir);
+       return err;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/nfc-virtual_ncidev-fix-memory-leak-in-virtual_nci_se.patch b/queue-5.15/nfc-virtual_ncidev-fix-memory-leak-in-virtual_nci_se.patch
new file mode 100644 (file)
index 0000000..12733d3
--- /dev/null
@@ -0,0 +1,78 @@
+From 5646547f674a4a922a02f7448faaa0c6e0fa7eb4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 11:05:05 +0800
+Subject: nfc: virtual_ncidev: Fix memory leak in virtual_nci_send()
+
+From: Shang XiaoJing <shangxiaojing@huawei.com>
+
+[ Upstream commit e840d8f4a1b323973052a1af5ad4edafcde8ae3d ]
+
+skb should be free in virtual_nci_send(), otherwise kmemleak will report
+memleak.
+
+Steps for reproduction (simulated in qemu):
+       cd tools/testing/selftests/nci
+       make
+       ./nci_dev
+
+BUG: memory leak
+unreferenced object 0xffff888107588000 (size 208):
+  comm "nci_dev", pid 206, jiffies 4294945376 (age 368.248s)
+  hex dump (first 32 bytes):
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  backtrace:
+    [<000000008d94c8fd>] __alloc_skb+0x1da/0x290
+    [<00000000278bc7f8>] nci_send_cmd+0xa3/0x350
+    [<0000000081256a22>] nci_reset_req+0x6b/0xa0
+    [<000000009e721112>] __nci_request+0x90/0x250
+    [<000000005d556e59>] nci_dev_up+0x217/0x5b0
+    [<00000000e618ce62>] nfc_dev_up+0x114/0x220
+    [<00000000981e226b>] nfc_genl_dev_up+0x94/0xe0
+    [<000000009bb03517>] genl_family_rcv_msg_doit.isra.14+0x228/0x2d0
+    [<00000000b7f8c101>] genl_rcv_msg+0x35c/0x640
+    [<00000000c94075ff>] netlink_rcv_skb+0x11e/0x350
+    [<00000000440cfb1e>] genl_rcv+0x24/0x40
+    [<0000000062593b40>] netlink_unicast+0x43f/0x640
+    [<000000001d0b13cc>] netlink_sendmsg+0x73a/0xbf0
+    [<000000003272487f>] __sys_sendto+0x324/0x370
+    [<00000000ef9f1747>] __x64_sys_sendto+0xdd/0x1b0
+    [<000000001e437841>] do_syscall_64+0x3f/0x90
+
+Fixes: e624e6c3e777 ("nfc: Add a virtual nci device driver")
+Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Link: https://lore.kernel.org/r/20221020030505.15572-1-shangxiaojing@huawei.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nfc/virtual_ncidev.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/nfc/virtual_ncidev.c b/drivers/nfc/virtual_ncidev.c
+index 221fa3bb8705..6317e8505aaa 100644
+--- a/drivers/nfc/virtual_ncidev.c
++++ b/drivers/nfc/virtual_ncidev.c
+@@ -54,16 +54,19 @@ static int virtual_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
+       mutex_lock(&nci_mutex);
+       if (state != virtual_ncidev_enabled) {
+               mutex_unlock(&nci_mutex);
++              kfree_skb(skb);
+               return 0;
+       }
+       if (send_buff) {
+               mutex_unlock(&nci_mutex);
++              kfree_skb(skb);
+               return -1;
+       }
+       send_buff = skb_copy(skb, GFP_KERNEL);
+       mutex_unlock(&nci_mutex);
+       wake_up_interruptible(&wq);
++      consume_skb(skb);
+       return 0;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/nh-fix-scope-used-to-find-saddr-when-adding-non-gw-n.patch b/queue-5.15/nh-fix-scope-used-to-find-saddr-when-adding-non-gw-n.patch
new file mode 100644 (file)
index 0000000..1edcc73
--- /dev/null
@@ -0,0 +1,42 @@
+From e66cb200fbff3dc6e62c09594ff33a7520d864bb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 12:09:52 +0200
+Subject: nh: fix scope used to find saddr when adding non gw nh
+
+From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
+
+[ Upstream commit bac0f937c343d651874f83b265ca8f5070ed4f06 ]
+
+As explained by Julian, fib_nh_scope is related to fib_nh_gw4, but
+fib_info_update_nhc_saddr() needs the scope of the route, which is
+the scope "before" fib_nh_scope, ie fib_nh_scope - 1.
+
+This patch fixes the problem described in commit 747c14307214 ("ip: fix
+dflt addr selection for connected nexthop").
+
+Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")
+Link: https://lore.kernel.org/netdev/6c8a44ba-c2d5-cdf-c5c7-5baf97cba38@ssi.bg/
+Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
+Reviewed-by: Julian Anastasov <ja@ssi.bg>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/nexthop.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
+index cc8f120149f6..6cc7d347ec0a 100644
+--- a/net/ipv4/nexthop.c
++++ b/net/ipv4/nexthop.c
+@@ -2535,7 +2535,7 @@ static int nh_create_ipv4(struct net *net, struct nexthop *nh,
+       if (!err) {
+               nh->nh_flags = fib_nh->fib_nh_flags;
+               fib_info_update_nhc_saddr(net, &fib_nh->nh_common,
+-                                        fib_nh->fib_nh_scope);
++                                        !fib_nh->fib_nh_scope ? 0 : fib_nh->fib_nh_scope - 1);
+       } else {
+               fib_nh_release(net, fib_nh);
+       }
+-- 
+2.35.1
+
diff --git a/queue-5.15/openvswitch-switch-from-warn-to-pr_warn.patch b/queue-5.15/openvswitch-switch-from-warn-to-pr_warn.patch
new file mode 100644 (file)
index 0000000..cdf191a
--- /dev/null
@@ -0,0 +1,42 @@
+From 92252be60b5847b78887d5e21c6e0de14f93c280 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Oct 2022 06:50:17 -0400
+Subject: openvswitch: switch from WARN to pr_warn
+
+From: Aaron Conole <aconole@redhat.com>
+
+[ Upstream commit fd954cc1919e35cb92f78671cab6e42d661945a3 ]
+
+As noted by Paolo Abeni, pr_warn doesn't generate any splat and can still
+preserve the warning to the user that feature downgrade occurred.  We
+likely cannot introduce other kinds of checks / enforcement here because
+syzbot can generate different genl versions to the datapath.
+
+Reported-by: syzbot+31cde0bef4bbf8ba2d86@syzkaller.appspotmail.com
+Fixes: 44da5ae5fbea ("openvswitch: Drop user features if old user space attempted to create datapath")
+Cc: Thomas Graf <tgraf@suug.ch>
+Signed-off-by: Aaron Conole <aconole@redhat.com>
+Acked-by: Ilya Maximets <i.maximets@ovn.org>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/openvswitch/datapath.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
+index 46ef1525b2e5..94c48122fdc3 100644
+--- a/net/openvswitch/datapath.c
++++ b/net/openvswitch/datapath.c
+@@ -1605,7 +1605,8 @@ static void ovs_dp_reset_user_features(struct sk_buff *skb,
+       if (IS_ERR(dp))
+               return;
+-      WARN(dp->user_features, "Dropping previously announced user features\n");
++      pr_warn("%s: Dropping previously announced user features\n",
++              ovs_dp_name(dp));
+       dp->user_features = 0;
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/perf-fix-missing-sigtraps.patch b/queue-5.15/perf-fix-missing-sigtraps.patch
new file mode 100644 (file)
index 0000000..0d1c142
--- /dev/null
@@ -0,0 +1,452 @@
+From 8af175996347ad41edaeac15221bc94b2ee80d52 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Oct 2022 15:00:39 +0200
+Subject: perf: Fix missing SIGTRAPs
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+[ Upstream commit ca6c21327c6af02b7eec31ce4b9a740a18c6c13f ]
+
+Marco reported:
+
+Due to the implementation of how SIGTRAP are delivered if
+perf_event_attr::sigtrap is set, we've noticed 3 issues:
+
+  1. Missing SIGTRAP due to a race with event_sched_out() (more
+     details below).
+
+  2. Hardware PMU events being disabled due to returning 1 from
+     perf_event_overflow(). The only way to re-enable the event is
+     for user space to first "properly" disable the event and then
+     re-enable it.
+
+  3. The inability to automatically disable an event after a
+     specified number of overflows via PERF_EVENT_IOC_REFRESH.
+
+The worst of the 3 issues is problem (1), which occurs when a
+pending_disable is "consumed" by a racing event_sched_out(), observed
+as follows:
+
+               CPU0                    |       CPU1
+       --------------------------------+---------------------------
+       __perf_event_overflow()         |
+        perf_event_disable_inatomic()  |
+         pending_disable = CPU0        | ...
+                                       | _perf_event_enable()
+                                       |  event_function_call()
+                                       |   task_function_call()
+                                       |    /* sends IPI to CPU0 */
+       <IPI>                           | ...
+        __perf_event_enable()          +---------------------------
+         ctx_resched()
+          task_ctx_sched_out()
+           ctx_sched_out()
+            group_sched_out()
+             event_sched_out()
+              pending_disable = -1
+       </IPI>
+       <IRQ-work>
+        perf_pending_event()
+         perf_pending_event_disable()
+          /* Fails to send SIGTRAP because no pending_disable! */
+       </IRQ-work>
+
+In the above case, not only is that particular SIGTRAP missed, but also
+all future SIGTRAPs because 'event_limit' is not reset back to 1.
+
+To fix, rework pending delivery of SIGTRAP via IRQ-work by introduction
+of a separate 'pending_sigtrap', no longer using 'event_limit' and
+'pending_disable' for its delivery.
+
+Additionally; and different to Marco's proposed patch:
+
+ - recognise that pending_disable effectively duplicates oncpu for
+   the case where it is set. As such, change the irq_work handler to
+   use ->oncpu to target the event and use pending_* as boolean toggles.
+
+ - observe that SIGTRAP targets the ctx->task, so the context switch
+   optimization that carries contexts between tasks is invalid. If
+   the irq_work were delayed enough to hit after a context switch the
+   SIGTRAP would be delivered to the wrong task.
+
+ - observe that if the event gets scheduled out
+   (rotation/migration/context-switch/...) the irq-work would be
+   insufficient to deliver the SIGTRAP when the event gets scheduled
+   back in (the irq-work might still be pending on the old CPU).
+
+   Therefore have event_sched_out() convert the pending sigtrap into a
+   task_work which will deliver the signal at return_to_user.
+
+Fixes: 97ba62b27867 ("perf: Add support for SIGTRAP on perf events")
+Reported-by: Dmitry Vyukov <dvyukov@google.com>
+Debugged-by: Dmitry Vyukov <dvyukov@google.com>
+Reported-by: Marco Elver <elver@google.com>
+Debugged-by: Marco Elver <elver@google.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Marco Elver <elver@google.com>
+Tested-by: Marco Elver <elver@google.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/perf_event.h  |  19 ++++-
+ kernel/events/core.c        | 153 +++++++++++++++++++++++++++---------
+ kernel/events/ring_buffer.c |   2 +-
+ 3 files changed, 130 insertions(+), 44 deletions(-)
+
+diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
+index 6cce33e7e7ac..014eb0a963fc 100644
+--- a/include/linux/perf_event.h
++++ b/include/linux/perf_event.h
+@@ -723,11 +723,14 @@ struct perf_event {
+       struct fasync_struct            *fasync;
+       /* delayed work for NMIs and such */
+-      int                             pending_wakeup;
+-      int                             pending_kill;
+-      int                             pending_disable;
++      unsigned int                    pending_wakeup;
++      unsigned int                    pending_kill;
++      unsigned int                    pending_disable;
++      unsigned int                    pending_sigtrap;
+       unsigned long                   pending_addr;   /* SIGTRAP */
+-      struct irq_work                 pending;
++      struct irq_work                 pending_irq;
++      struct callback_head            pending_task;
++      unsigned int                    pending_work;
+       atomic_t                        event_limit;
+@@ -841,6 +844,14 @@ struct perf_event_context {
+ #endif
+       void                            *task_ctx_data; /* pmu specific data */
+       struct rcu_head                 rcu_head;
++
++      /*
++       * Sum (event->pending_sigtrap + event->pending_work)
++       *
++       * The SIGTRAP is targeted at ctx->task, as such it won't do changing
++       * that until the signal is delivered.
++       */
++      local_t                         nr_pending;
+ };
+ /*
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index c6c7a4d80573..59654c737168 100644
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -54,6 +54,7 @@
+ #include <linux/highmem.h>
+ #include <linux/pgtable.h>
+ #include <linux/buildid.h>
++#include <linux/task_work.h>
+ #include "internal.h"
+@@ -2352,11 +2353,26 @@ event_sched_out(struct perf_event *event,
+       event->pmu->del(event, 0);
+       event->oncpu = -1;
+-      if (READ_ONCE(event->pending_disable) >= 0) {
+-              WRITE_ONCE(event->pending_disable, -1);
++      if (event->pending_disable) {
++              event->pending_disable = 0;
+               perf_cgroup_event_disable(event, ctx);
+               state = PERF_EVENT_STATE_OFF;
+       }
++
++      if (event->pending_sigtrap) {
++              bool dec = true;
++
++              event->pending_sigtrap = 0;
++              if (state != PERF_EVENT_STATE_OFF &&
++                  !event->pending_work) {
++                      event->pending_work = 1;
++                      dec = false;
++                      task_work_add(current, &event->pending_task, TWA_RESUME);
++              }
++              if (dec)
++                      local_dec(&event->ctx->nr_pending);
++      }
++
+       perf_event_set_state(event, state);
+       if (!is_software_event(event))
+@@ -2508,7 +2524,7 @@ static void __perf_event_disable(struct perf_event *event,
+  * hold the top-level event's child_mutex, so any descendant that
+  * goes to exit will block in perf_event_exit_event().
+  *
+- * When called from perf_pending_event it's OK because event->ctx
++ * When called from perf_pending_irq it's OK because event->ctx
+  * is the current context on this CPU and preemption is disabled,
+  * hence we can't get into perf_event_task_sched_out for this context.
+  */
+@@ -2547,9 +2563,8 @@ EXPORT_SYMBOL_GPL(perf_event_disable);
+ void perf_event_disable_inatomic(struct perf_event *event)
+ {
+-      WRITE_ONCE(event->pending_disable, smp_processor_id());
+-      /* can fail, see perf_pending_event_disable() */
+-      irq_work_queue(&event->pending);
++      event->pending_disable = 1;
++      irq_work_queue(&event->pending_irq);
+ }
+ #define MAX_INTERRUPTS (~0ULL)
+@@ -3506,11 +3521,23 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
+               raw_spin_lock_nested(&next_ctx->lock, SINGLE_DEPTH_NESTING);
+               if (context_equiv(ctx, next_ctx)) {
++                      perf_pmu_disable(pmu);
++
++                      /* PMIs are disabled; ctx->nr_pending is stable. */
++                      if (local_read(&ctx->nr_pending) ||
++                          local_read(&next_ctx->nr_pending)) {
++                              /*
++                               * Must not swap out ctx when there's pending
++                               * events that rely on the ctx->task relation.
++                               */
++                              raw_spin_unlock(&next_ctx->lock);
++                              rcu_read_unlock();
++                              goto inside_switch;
++                      }
++
+                       WRITE_ONCE(ctx->task, next);
+                       WRITE_ONCE(next_ctx->task, task);
+-                      perf_pmu_disable(pmu);
+-
+                       if (cpuctx->sched_cb_usage && pmu->sched_task)
+                               pmu->sched_task(ctx, false);
+@@ -3551,6 +3578,7 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,
+               raw_spin_lock(&ctx->lock);
+               perf_pmu_disable(pmu);
++inside_switch:
+               if (cpuctx->sched_cb_usage && pmu->sched_task)
+                       pmu->sched_task(ctx, false);
+               task_ctx_sched_out(cpuctx, ctx, EVENT_ALL);
+@@ -5030,7 +5058,7 @@ static void perf_addr_filters_splice(struct perf_event *event,
+ static void _free_event(struct perf_event *event)
+ {
+-      irq_work_sync(&event->pending);
++      irq_work_sync(&event->pending_irq);
+       unaccount_event(event);
+@@ -6524,7 +6552,8 @@ static void perf_sigtrap(struct perf_event *event)
+               return;
+       /*
+-       * perf_pending_event() can race with the task exiting.
++       * Both perf_pending_task() and perf_pending_irq() can race with the
++       * task exiting.
+        */
+       if (current->flags & PF_EXITING)
+               return;
+@@ -6533,23 +6562,33 @@ static void perf_sigtrap(struct perf_event *event)
+                     event->attr.type, event->attr.sig_data);
+ }
+-static void perf_pending_event_disable(struct perf_event *event)
++/*
++ * Deliver the pending work in-event-context or follow the context.
++ */
++static void __perf_pending_irq(struct perf_event *event)
+ {
+-      int cpu = READ_ONCE(event->pending_disable);
++      int cpu = READ_ONCE(event->oncpu);
++      /*
++       * If the event isn't running; we done. event_sched_out() will have
++       * taken care of things.
++       */
+       if (cpu < 0)
+               return;
++      /*
++       * Yay, we hit home and are in the context of the event.
++       */
+       if (cpu == smp_processor_id()) {
+-              WRITE_ONCE(event->pending_disable, -1);
+-
+-              if (event->attr.sigtrap) {
++              if (event->pending_sigtrap) {
++                      event->pending_sigtrap = 0;
+                       perf_sigtrap(event);
+-                      atomic_set_release(&event->event_limit, 1); /* rearm event */
+-                      return;
++                      local_dec(&event->ctx->nr_pending);
++              }
++              if (event->pending_disable) {
++                      event->pending_disable = 0;
++                      perf_event_disable_local(event);
+               }
+-
+-              perf_event_disable_local(event);
+               return;
+       }
+@@ -6569,36 +6608,63 @@ static void perf_pending_event_disable(struct perf_event *event)
+        *                                irq_work_queue(); // FAILS
+        *
+        *  irq_work_run()
+-       *    perf_pending_event()
++       *    perf_pending_irq()
+        *
+        * But the event runs on CPU-B and wants disabling there.
+        */
+-      irq_work_queue_on(&event->pending, cpu);
++      irq_work_queue_on(&event->pending_irq, cpu);
+ }
+-static void perf_pending_event(struct irq_work *entry)
++static void perf_pending_irq(struct irq_work *entry)
+ {
+-      struct perf_event *event = container_of(entry, struct perf_event, pending);
++      struct perf_event *event = container_of(entry, struct perf_event, pending_irq);
+       int rctx;
+-      rctx = perf_swevent_get_recursion_context();
+       /*
+        * If we 'fail' here, that's OK, it means recursion is already disabled
+        * and we won't recurse 'further'.
+        */
++      rctx = perf_swevent_get_recursion_context();
+-      perf_pending_event_disable(event);
+-
++      /*
++       * The wakeup isn't bound to the context of the event -- it can happen
++       * irrespective of where the event is.
++       */
+       if (event->pending_wakeup) {
+               event->pending_wakeup = 0;
+               perf_event_wakeup(event);
+       }
++      __perf_pending_irq(event);
++
+       if (rctx >= 0)
+               perf_swevent_put_recursion_context(rctx);
+ }
+-/*
++static void perf_pending_task(struct callback_head *head)
++{
++      struct perf_event *event = container_of(head, struct perf_event, pending_task);
++      int rctx;
++
++      /*
++       * If we 'fail' here, that's OK, it means recursion is already disabled
++       * and we won't recurse 'further'.
++       */
++      preempt_disable_notrace();
++      rctx = perf_swevent_get_recursion_context();
++
++      if (event->pending_work) {
++              event->pending_work = 0;
++              perf_sigtrap(event);
++              local_dec(&event->ctx->nr_pending);
++      }
++
++      if (rctx >= 0)
++              perf_swevent_put_recursion_context(rctx);
++      preempt_enable_notrace();
++}
++
++/*              
+  * We assume there is only KVM supporting the callbacks.
+  * Later on, we might change it to a list if there is
+  * another virtualization implementation supporting the callbacks.
+@@ -9229,8 +9295,8 @@ int perf_event_account_interrupt(struct perf_event *event)
+  */
+ static int __perf_event_overflow(struct perf_event *event,
+-                                 int throttle, struct perf_sample_data *data,
+-                                 struct pt_regs *regs)
++                               int throttle, struct perf_sample_data *data,
++                               struct pt_regs *regs)
+ {
+       int events = atomic_read(&event->event_limit);
+       int ret = 0;
+@@ -9253,24 +9319,36 @@ static int __perf_event_overflow(struct perf_event *event,
+       if (events && atomic_dec_and_test(&event->event_limit)) {
+               ret = 1;
+               event->pending_kill = POLL_HUP;
+-              event->pending_addr = data->addr;
+-
+               perf_event_disable_inatomic(event);
+       }
++      if (event->attr.sigtrap) {
++              /*
++               * Should not be able to return to user space without processing
++               * pending_sigtrap (kernel events can overflow multiple times).
++               */
++              WARN_ON_ONCE(event->pending_sigtrap && event->attr.exclude_kernel);
++              if (!event->pending_sigtrap) {
++                      event->pending_sigtrap = 1;
++                      local_inc(&event->ctx->nr_pending);
++              }
++              event->pending_addr = data->addr;
++              irq_work_queue(&event->pending_irq);
++      }
++
+       READ_ONCE(event->overflow_handler)(event, data, regs);
+       if (*perf_event_fasync(event) && event->pending_kill) {
+               event->pending_wakeup = 1;
+-              irq_work_queue(&event->pending);
++              irq_work_queue(&event->pending_irq);
+       }
+       return ret;
+ }
+ int perf_event_overflow(struct perf_event *event,
+-                        struct perf_sample_data *data,
+-                        struct pt_regs *regs)
++                      struct perf_sample_data *data,
++                      struct pt_regs *regs)
+ {
+       return __perf_event_overflow(event, 1, data, regs);
+ }
+@@ -11576,8 +11654,8 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
+       init_waitqueue_head(&event->waitq);
+-      event->pending_disable = -1;
+-      init_irq_work(&event->pending, perf_pending_event);
++      init_irq_work(&event->pending_irq, perf_pending_irq);
++      init_task_work(&event->pending_task, perf_pending_task);
+       mutex_init(&event->mmap_mutex);
+       raw_spin_lock_init(&event->addr_filters.lock);
+@@ -11599,9 +11677,6 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
+       if (parent_event)
+               event->event_caps = parent_event->event_caps;
+-      if (event->attr.sigtrap)
+-              atomic_set(&event->event_limit, 1);
+-
+       if (task) {
+               event->attach_state = PERF_ATTACH_TASK;
+               /*
+diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
+index fb35b926024c..f40da32f5e75 100644
+--- a/kernel/events/ring_buffer.c
++++ b/kernel/events/ring_buffer.c
+@@ -22,7 +22,7 @@ static void perf_output_wakeup(struct perf_output_handle *handle)
+       atomic_set(&handle->rb->poll, EPOLLIN);
+       handle->event->pending_wakeup = 1;
+-      irq_work_queue(&handle->event->pending);
++      irq_work_queue(&handle->event->pending_irq);
+ }
+ /*
+-- 
+2.35.1
+
diff --git a/queue-5.15/perf-vendor-events-arm64-fix-incorrect-hisi-hip08-l3.patch b/queue-5.15/perf-vendor-events-arm64-fix-incorrect-hisi-hip08-l3.patch
new file mode 100644 (file)
index 0000000..501bf73
--- /dev/null
@@ -0,0 +1,84 @@
+From 8b219408cece6f56f2a996c08f84a39752910820 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 18:50:33 +0800
+Subject: perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics
+
+From: Shang XiaoJing <shangxiaojing@huawei.com>
+
+[ Upstream commit e9229d5b6254a75291536f582652c599957344d2 ]
+
+Commit 0cc177cfc95d565e ("perf vendor events arm64: Add Hisi hip08 L3
+metrics") add L3 metrics of hip08, but some metrics (IF_BP_MISP_BR_RET,
+IF_BP_MISP_BR_RET, IF_BP_MISP_BR_BL) have incorrect event number due to
+the mistakes in document, which caused incorrect result. Fix the
+incorrect metrics.
+
+Before:
+
+  65,811,214,308       armv8_pmuv3_0/event=0x1014/     # 18.87 push_branch
+                                                       # -40.19 other_branch
+  3,564,316,780        BR_MIS_PRED                             # 0.51 indirect_branch
+                                                       # 21.81 pop_branch
+
+After:
+
+  6,537,146,245        BR_MIS_PRED                     # 0.48 indirect_branch
+                                               # 0.47 pop_branch
+                                               # 0.00 push_branch
+                                               # 0.05 other_branch
+
+Fixes: 0cc177cfc95d565e ("perf vendor events arm64: Add Hisi hip08 L3 metrics")
+Reviewed-by: John Garry <john.garry@huawei.com>
+Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
+Acked-by: James Clark <james.clark@arm.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: John Garry <john.garry@huawei.com>
+Cc: Kajol Jain <kjain@linux.ibm.com>
+Cc: Leo Yan <leo.yan@linaro.org>
+Cc: linux-arm-kernel@lists.infradead.org
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Mike Leach <mike.leach@linaro.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Will Deacon <will@kernel.org>
+Link: https://lore.kernel.org/r/20221021105035.10000-2-shangxiaojing@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json
+index dda8e59149d2..be23d3c89a79 100644
+--- a/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json
++++ b/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json
+@@ -112,21 +112,21 @@
+         "MetricName": "indirect_branch"
+     },
+     {
+-        "MetricExpr": "(armv8_pmuv3_0@event\\=0x1014@ + armv8_pmuv3_0@event\\=0x1018@) / BR_MIS_PRED",
++        "MetricExpr": "(armv8_pmuv3_0@event\\=0x1013@ + armv8_pmuv3_0@event\\=0x1016@) / BR_MIS_PRED",
+         "PublicDescription": "Push branch L3 topdown metric",
+         "BriefDescription": "Push branch L3 topdown metric",
+         "MetricGroup": "TopDownL3",
+         "MetricName": "push_branch"
+     },
+     {
+-        "MetricExpr": "armv8_pmuv3_0@event\\=0x100c@ / BR_MIS_PRED",
++        "MetricExpr": "armv8_pmuv3_0@event\\=0x100d@ / BR_MIS_PRED",
+         "PublicDescription": "Pop branch L3 topdown metric",
+         "BriefDescription": "Pop branch L3 topdown metric",
+         "MetricGroup": "TopDownL3",
+         "MetricName": "pop_branch"
+     },
+     {
+-        "MetricExpr": "(BR_MIS_PRED - armv8_pmuv3_0@event\\=0x1010@ - armv8_pmuv3_0@event\\=0x1014@ - armv8_pmuv3_0@event\\=0x1018@ - armv8_pmuv3_0@event\\=0x100c@) / BR_MIS_PRED",
++        "MetricExpr": "(BR_MIS_PRED - armv8_pmuv3_0@event\\=0x1010@ - armv8_pmuv3_0@event\\=0x1013@ - armv8_pmuv3_0@event\\=0x1016@ - armv8_pmuv3_0@event\\=0x100d@) / BR_MIS_PRED",
+         "PublicDescription": "Other branch L3 topdown metric",
+         "BriefDescription": "Other branch L3 topdown metric",
+         "MetricGroup": "TopDownL3",
+-- 
+2.35.1
+
diff --git a/queue-5.15/perf-vendor-events-power10-fix-hv-24x7-metric-events.patch b/queue-5.15/perf-vendor-events-power10-fix-hv-24x7-metric-events.patch
new file mode 100644 (file)
index 0000000..351e3de
--- /dev/null
@@ -0,0 +1,313 @@
+From e0074c0cc4b5193ce23c870afc4b754dbedf8584 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Oct 2022 19:32:20 +0530
+Subject: perf vendor events power10: Fix hv-24x7 metric events
+
+From: Kajol Jain <kjain@linux.ibm.com>
+
+[ Upstream commit b92dd11725a7c57f55e148c7d3ce58a86f480575 ]
+
+Testcase stat_all_metrics.sh fails in powerpc:
+
+  90: perf all metrics test : FAILED!
+
+The testcase "stat_all_metrics.sh" verifies perf stat result for all the
+metric events present in perf list.  It runs perf metric events with
+various commands and expects non-empty metric result.
+
+Incase of powerpc:hv-24x7 events, some of the event count can be 0 based
+on system configuration. And if that event used as denominator in divide
+equation, it can cause divide by 0 error. The current nest_metric.json
+file creating divide by 0 issue for some of the metric events, which
+results in failure of the "stat_all_metrics.sh" test case.
+
+Most of the metrics events have cycles or an event which expect to have
+a larger value as denominator, so adding 1 to the denominator of the
+metric expression as a fix.
+
+Result in powerpc box after this patch changes:
+
+  90: perf all metrics test : Ok
+
+Fixes: a3cbcadfdfc330c2 ("perf vendor events power10: Adds 24x7 nest metric events for power10 platform")
+Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
+Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
+Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
+Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Kajol Jain <kjain@linux.ibm.com>
+Cc: linuxppc-dev@lists.ozlabs.org
+Cc: Michael Ellerman <mpe@ellerman.id.au>
+Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
+Link: https://lore.kernel.org/r/20221014140220.122251-1-kjain@linux.ibm.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../arch/powerpc/power10/nest_metrics.json    | 72 +++++++++----------
+ 1 file changed, 36 insertions(+), 36 deletions(-)
+
+diff --git a/tools/perf/pmu-events/arch/powerpc/power10/nest_metrics.json b/tools/perf/pmu-events/arch/powerpc/power10/nest_metrics.json
+index 8ba3e81c9808..fe050d44374b 100644
+--- a/tools/perf/pmu-events/arch/powerpc/power10/nest_metrics.json
++++ b/tools/perf/pmu-events/arch/powerpc/power10/nest_metrics.json
+@@ -1,13 +1,13 @@
+ [
+     {
+       "MetricName": "VEC_GROUP_PUMP_RETRY_RATIO_P01",
+-      "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP01\\,chip\\=?@ / hv_24x7@PM_PB_VG_PUMP01\\,chip\\=?@) * 100",
++      "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP01\\,chip\\=?@ / (1 + hv_24x7@PM_PB_VG_PUMP01\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "VEC_GROUP_PUMP_RETRY_RATIO_P23",
+-      "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP23\\,chip\\=?@ / hv_24x7@PM_PB_VG_PUMP23\\,chip\\=?@) * 100",
++      "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP23\\,chip\\=?@ / (1 + hv_24x7@PM_PB_VG_PUMP23\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+@@ -61,13 +61,13 @@
+     },
+     {
+       "MetricName": "REMOTE_NODE_PUMPS_RETRIES_RATIO_P01",
+-      "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP01\\,chip\\=?@ / hv_24x7@PM_PB_RNS_PUMP01\\,chip\\=?@) * 100",
++      "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP01\\,chip\\=?@ / (1 + hv_24x7@PM_PB_RNS_PUMP01\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "REMOTE_NODE_PUMPS_RETRIES_RATIO_P23",
+-      "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP23\\,chip\\=?@ / hv_24x7@PM_PB_RNS_PUMP23\\,chip\\=?@) * 100",
++      "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP23\\,chip\\=?@ / (1 + hv_24x7@PM_PB_RNS_PUMP23\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+@@ -151,193 +151,193 @@
+     },
+     {
+       "MetricName": "XLINK0_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK1_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK2_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK3_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK4_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK5_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK6_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK7_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK0_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK1_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK2_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK3_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK4_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK5_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK6_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "XLINK7_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK0_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK1_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK2_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK3_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK4_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK5_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK6_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK7_OUT_TOTAL_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK0_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK1_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK2_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK3_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK4_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK5_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK6_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+     {
+       "MetricName": "ALINK7_OUT_DATA_UTILIZATION",
+-      "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
++      "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100",
+       "ScaleUnit": "1.063%",
+       "AggregationMode": "PerChip"
+     },
+-- 
+2.35.1
+
diff --git a/queue-5.15/perf-x86-intel-lbr-use-setup_clear_cpu_cap-instead-o.patch b/queue-5.15/perf-x86-intel-lbr-use-setup_clear_cpu_cap-instead-o.patch
new file mode 100644 (file)
index 0000000..6bb89c9
--- /dev/null
@@ -0,0 +1,41 @@
+From 9d778db27427eaa13556b6781cf964a35553c3fe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 18 Jul 2022 17:11:19 +0300
+Subject: perf/x86/intel/lbr: Use setup_clear_cpu_cap() instead of
+ clear_cpu_cap()
+
+From: Maxim Levitsky <mlevitsk@redhat.com>
+
+[ Upstream commit b329f5ddc9ce4b622d9c7aaf5c6df4de52caf91a ]
+
+clear_cpu_cap(&boot_cpu_data) is very similar to setup_clear_cpu_cap()
+except that the latter also sets a bit in 'cpu_caps_cleared' which
+later clears the same cap in secondary cpus, which is likely what is
+meant here.
+
+Fixes: 47125db27e47 ("perf/x86/intel/lbr: Support Architectural LBR")
+Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
+Link: https://lkml.kernel.org/r/20220718141123.136106-2-mlevitsk@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/events/intel/lbr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
+index 673721387391..b3f92255cbd2 100644
+--- a/arch/x86/events/intel/lbr.c
++++ b/arch/x86/events/intel/lbr.c
+@@ -1847,7 +1847,7 @@ void __init intel_pmu_arch_lbr_init(void)
+       return;
+ clear_arch_lbr:
+-      clear_cpu_cap(&boot_cpu_data, X86_FEATURE_ARCH_LBR);
++      setup_clear_cpu_cap(X86_FEATURE_ARCH_LBR);
+ }
+ /**
+-- 
+2.35.1
+
diff --git a/queue-5.15/pm-domains-fix-handling-of-unavailable-disabled-idle.patch b/queue-5.15/pm-domains-fix-handling-of-unavailable-disabled-idle.patch
new file mode 100644 (file)
index 0000000..f1e544c
--- /dev/null
@@ -0,0 +1,44 @@
+From aaf507685cd9e4ae55d4f6de4a7461565dc2f25d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Oct 2022 13:34:32 +0100
+Subject: PM: domains: Fix handling of unavailable/disabled idle states
+
+From: Sudeep Holla <sudeep.holla@arm.com>
+
+[ Upstream commit e0c57a5c70c13317238cb19a7ded0eab4a5f7de5 ]
+
+Platforms can provide the information about the availability of each
+idle states via status flag. Platforms may have to disable one or more
+idle states for various reasons like broken firmware or other unmet
+dependencies.
+
+Fix handling of such unavailable/disabled idle states by ignoring them
+while parsing the states.
+
+Fixes: a3381e3a65cb ("PM / domains: Fix up domain-idle-states OF parsing")
+Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
+Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/power/domain.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
+index 7f3d21e6fdfb..94fe30c187ad 100644
+--- a/drivers/base/power/domain.c
++++ b/drivers/base/power/domain.c
+@@ -2889,6 +2889,10 @@ static int genpd_iterate_idle_states(struct device_node *dn,
+               np = it.node;
+               if (!of_match_node(idle_state_match, np))
+                       continue;
++
++              if (!of_device_is_available(np))
++                      continue;
++
+               if (states) {
+                       ret = genpd_parse_state(&states[i], np);
+                       if (ret) {
+-- 
+2.35.1
+
diff --git a/queue-5.15/pm-hibernate-allow-hybrid-sleep-to-work-with-s2idle.patch b/queue-5.15/pm-hibernate-allow-hybrid-sleep-to-work-with-s2idle.patch
new file mode 100644 (file)
index 0000000..8f6280c
--- /dev/null
@@ -0,0 +1,43 @@
+From 55e8ba739fb00fc92113a0e00605afcb017b0396 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Oct 2022 22:50:17 -0500
+Subject: PM: hibernate: Allow hybrid sleep to work with s2idle
+
+From: Mario Limonciello <mario.limonciello@amd.com>
+
+[ Upstream commit 85850af4fc47132f3f2f0dd698b90f67906600b4 ]
+
+Hybrid sleep is currently hardcoded to only operate with S3 even
+on systems that might not support it.
+
+Instead of assuming this mode is what the user wants to use, for
+hybrid sleep follow the setting of `mem_sleep_current` which
+will respect mem_sleep_default kernel command line and policy
+decisions made by the presence of the FADT low power idle bit.
+
+Fixes: 81d45bdf8913 ("PM / hibernate: Untangle power_down()")
+Reported-and-tested-by: kolAflash <kolAflash@kolahilft.de>
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=216574
+Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/power/hibernate.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
+index d926852f8119..9abc73d500fb 100644
+--- a/kernel/power/hibernate.c
++++ b/kernel/power/hibernate.c
+@@ -640,7 +640,7 @@ static void power_down(void)
+       int error;
+       if (hibernation_mode == HIBERNATION_SUSPEND) {
+-              error = suspend_devices_and_enter(PM_SUSPEND_MEM);
++              error = suspend_devices_and_enter(mem_sleep_current);
+               if (error) {
+                       hibernation_mode = hibernation_ops ?
+                                               HIBERNATION_PLATFORM :
+-- 
+2.35.1
+
diff --git a/queue-5.15/sched-core-fix-comparison-in-sched_group_cookie_matc.patch b/queue-5.15/sched-core-fix-comparison-in-sched_group_cookie_matc.patch
new file mode 100644 (file)
index 0000000..70b5d1b
--- /dev/null
@@ -0,0 +1,72 @@
+From 594b7c2fdac9ada1a4e3936b28e9f57ed78bcacf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 8 Oct 2022 10:27:09 +0800
+Subject: sched/core: Fix comparison in sched_group_cookie_match()
+
+From: Lin Shengwang <linshengwang1@huawei.com>
+
+[ Upstream commit e705968dd687574b6ca3ebe772683d5642759132 ]
+
+In commit 97886d9dcd86 ("sched: Migration changes for core scheduling"),
+sched_group_cookie_match() was added to help determine if a cookie
+matches the core state.
+
+However, while it iterates the SMT group, it fails to actually use the
+RQ for each of the CPUs iterated, use cpu_rq(cpu) instead of rq to fix
+things.
+
+Fixes: 97886d9dcd86 ("sched: Migration changes for core scheduling")
+Signed-off-by: Lin Shengwang <linshengwang1@huawei.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/20221008022709.642-1-linshengwang1@huawei.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/sched/sched.h | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
+index e49902898253..7a3fcd70aa86 100644
+--- a/kernel/sched/sched.h
++++ b/kernel/sched/sched.h
+@@ -1148,6 +1148,14 @@ static inline bool is_migration_disabled(struct task_struct *p)
+ #endif
+ }
++DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
++
++#define cpu_rq(cpu)           (&per_cpu(runqueues, (cpu)))
++#define this_rq()             this_cpu_ptr(&runqueues)
++#define task_rq(p)            cpu_rq(task_cpu(p))
++#define cpu_curr(cpu)         (cpu_rq(cpu)->curr)
++#define raw_rq()              raw_cpu_ptr(&runqueues)
++
+ struct sched_group;
+ #ifdef CONFIG_SCHED_CORE
+ static inline struct cpumask *sched_group_span(struct sched_group *sg);
+@@ -1235,7 +1243,7 @@ static inline bool sched_group_cookie_match(struct rq *rq,
+               return true;
+       for_each_cpu_and(cpu, sched_group_span(group), p->cpus_ptr) {
+-              if (sched_core_cookie_match(rq, p))
++              if (sched_core_cookie_match(cpu_rq(cpu), p))
+                       return true;
+       }
+       return false;
+@@ -1361,14 +1369,6 @@ static inline void update_idle_core(struct rq *rq)
+ static inline void update_idle_core(struct rq *rq) { }
+ #endif
+-DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
+-
+-#define cpu_rq(cpu)           (&per_cpu(runqueues, (cpu)))
+-#define this_rq()             this_cpu_ptr(&runqueues)
+-#define task_rq(p)            cpu_rq(task_cpu(p))
+-#define cpu_curr(cpu)         (cpu_rq(cpu)->curr)
+-#define raw_rq()              raw_cpu_ptr(&runqueues)
+-
+ #ifdef CONFIG_FAIR_GROUP_SCHED
+ static inline struct task_struct *task_of(struct sched_entity *se)
+ {
+-- 
+2.35.1
+
index 1b5f80aa02e1f65399e7b6f1cf15877d258bec4d..5bda0b7f863a29a2aa2ce98cad0f8aaa0a236ca4 100644 (file)
@@ -53,3 +53,74 @@ revert-scsi-lpfc-sli-path-split-refactor-lpfc_iocbq.patch
 mmc-block-remove-error-check-of-hw_reset-on-reset.patch
 ethtool-eeprom-fix-null-deref-on-genl_info-in-dump.patch
 net-ieee802154-fix-error-return-code-in-dgram_bind.patch
+media-v4l2-fix-v4l2_i2c_subdev_set_name-function-doc.patch
+media-atomisp-prevent-integer-overflow-in-sh_css_set.patch
+drm-msm-fix-return-type-of-mdp4_lvds_connector_mode_.patch
+kvm-selftests-fix-number-of-pages-for-memory-slot-in.patch
+asoc-qcom-lpass-cpu-mark-hdmi-tx-registers-as-volati.patch
+perf-fix-missing-sigtraps.patch
+sched-core-fix-comparison-in-sched_group_cookie_matc.patch
+arc-iounmap-arg-is-volatile.patch
+mtd-rawnand-intel-add-missing-of_node_put-in-ebu_nan.patch
+asoc-qcom-lpass-cpu-mark-hdmi-tx-parity-register-as-.patch
+alsa-ac97-fix-possible-memory-leak-in-snd_ac97_dev_r.patch
+perf-x86-intel-lbr-use-setup_clear_cpu_cap-instead-o.patch
+tipc-fix-a-null-ptr-deref-in-tipc_topsrv_accept.patch
+net-netsec-fix-error-handling-in-netsec_register_mdi.patch
+net-hinic-fix-incorrect-assignment-issue-in-hinic_se.patch
+net-hinic-fix-memory-leak-when-reading-function-tabl.patch
+net-hinic-fix-the-issue-of-cmdq-memory-leaks.patch
+net-hinic-fix-the-issue-of-double-release-mbox-callb.patch
+net-macb-specify-phy-pm-management-done-by-mac.patch
+nfc-virtual_ncidev-fix-memory-leak-in-virtual_nci_se.patch
+x86-unwind-orc-fix-unreliable-stack-dump-with-gcov.patch
+amd-xgbe-fix-the-sfp-compliance-codes-check-for-dac-.patch
+amd-xgbe-add-the-bit-rate-quirk-for-molex-cables.patch
+drm-i915-dp-reset-frl-trained-flag-before-restarting.patch
+atlantic-fix-deadlock-at-aq_nic_stop.patch
+kcm-annotate-data-races-around-kcm-rx_psock.patch
+kcm-annotate-data-races-around-kcm-rx_wait.patch
+net-fix-uaf-issue-in-nfqnl_nf_hook_drop-when-ops_ini.patch
+net-lantiq_etop-don-t-free-skb-when-returning-netdev.patch
+tcp-minor-optimization-in-tcp_add_backlog.patch
+tcp-fix-a-signed-integer-overflow-bug-in-tcp_add_bac.patch
+tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch
+net-memcg-avoid-stalls-when-under-memory-pressure.patch
+drm-amdkfd-fix-memory-leak-in-kfd_mem_dmamap_userptr.patch
+can-mscan-mpc5xxx-mpc5xxx_can_probe-add-missing-put_.patch
+can-mcp251x-mcp251x_can_probe-add-missing-unregister.patch
+pm-hibernate-allow-hybrid-sleep-to-work-with-s2idle.patch
+media-vivid-s_fbuf-add-more-sanity-checks.patch
+media-vivid-dev-bitmap_cap-wasn-t-freed-in-all-cases.patch
+media-v4l2-dv-timings-add-sanity-checks-for-blanking.patch
+media-videodev2.h-v4l2_dv_bt_blanking_height-should-.patch
+media-vivid-set-num_in-outputs-to-0-if-not-supported.patch
+perf-vendor-events-power10-fix-hv-24x7-metric-events.patch
+ipv6-ensure-sane-device-mtu-in-tunnels.patch
+i40e-fix-ethtool-rx-flow-hash-setting-for-x722.patch
+i40e-fix-vf-hang-when-reset-is-triggered-on-another-.patch
+i40e-fix-flow-type-by-setting-gl_hash_inset-register.patch
+net-ksz884x-fix-missing-pci_disable_device-on-error-.patch
+pm-domains-fix-handling-of-unavailable-disabled-idle.patch
+perf-vendor-events-arm64-fix-incorrect-hisi-hip08-l3.patch
+net-fec-limit-register-access-on-i.mx6ul.patch
+net-ethernet-ave-fix-mac-to-be-in-charge-of-phy-pm.patch
+alsa-aoa-i2sbus-fix-possible-memory-leak-in-i2sbus_a.patch
+alsa-aoa-fix-i2s-device-accounting.patch
+openvswitch-switch-from-warn-to-pr_warn.patch
+net-ehea-fix-possible-memory-leak-in-ehea_register_p.patch
+net-bcmsysport-indicate-mac-is-in-charge-of-phy-pm.patch
+nh-fix-scope-used-to-find-saddr-when-adding-non-gw-n.patch
+net-broadcom-bcm4908enet-remove-redundant-variable-b.patch
+net-broadcom-bcm4908_enet-update-tx-stats-after-actu.patch
+netdevsim-remove-dir-in-nsim_dev_debugfs_init-when-c.patch
+net-mlx5e-do-not-increment-esn-when-updating-ipsec-e.patch
+net-mlx5e-extend-skb-room-check-to-include-ptp-sq.patch
+net-mlx5-fix-possible-use-after-free-in-async-comman.patch
+net-mlx5-print-more-info-on-pci-error-handlers.patch
+net-mlx5-update-fw-fatal-reporter-state-on-pci-handl.patch
+net-mlx5-fix-crash-during-sync-firmware-reset.patch
+net-do-not-sense-pfmemalloc-status-in-skb_append_pag.patch
+kcm-do-not-sense-pfmemalloc-status-in-kcm_sendpage.patch
+net-enetc-survive-memory-pressure-without-crashing.patch
+arm64-add-ampere1-to-the-spectre-bhb-affected-list.patch
diff --git a/queue-5.15/tcp-fix-a-signed-integer-overflow-bug-in-tcp_add_bac.patch b/queue-5.15/tcp-fix-a-signed-integer-overflow-bug-in-tcp_add_bac.patch
new file mode 100644 (file)
index 0000000..34bd409
--- /dev/null
@@ -0,0 +1,48 @@
+From f7d02ec5dcae9179146d149e5ccbe296b5a451bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 12:06:22 +0800
+Subject: tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
+
+From: Lu Wei <luwei32@huawei.com>
+
+[ Upstream commit ec791d8149ff60c40ad2074af3b92a39c916a03f ]
+
+The type of sk_rcvbuf and sk_sndbuf in struct sock is int, and
+in tcp_add_backlog(), the variable limit is caculated by adding
+sk_rcvbuf, sk_sndbuf and 64 * 1024, it may exceed the max value
+of int and overflow. This patch reduces the limit budget by
+halving the sndbuf to solve this issue since ACK packets are much
+smaller than the payload.
+
+Fixes: c9c3321257e1 ("tcp: add tcp_add_backlog()")
+Signed-off-by: Lu Wei <luwei32@huawei.com>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Acked-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_ipv4.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
+index bae5c4ec5786..42d4af632495 100644
+--- a/net/ipv4/tcp_ipv4.c
++++ b/net/ipv4/tcp_ipv4.c
+@@ -1912,11 +1912,13 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
+       __skb_push(skb, hdrlen);
+ no_coalesce:
++      limit = (u32)READ_ONCE(sk->sk_rcvbuf) + (u32)(READ_ONCE(sk->sk_sndbuf) >> 1);
++
+       /* Only socket owner can try to collapse/prune rx queues
+        * to reduce memory overhead, so add a little headroom here.
+        * Few sockets backlog are possibly concurrently non empty.
+        */
+-      limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf) + 64*1024;
++      limit += 64 * 1024;
+       if (unlikely(sk_add_backlog(sk, skb, limit))) {
+               bh_unlock_sock(sk);
+-- 
+2.35.1
+
diff --git a/queue-5.15/tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch b/queue-5.15/tcp-fix-indefinite-deferral-of-rto-with-sack-renegin.patch
new file mode 100644 (file)
index 0000000..2158002
--- /dev/null
@@ -0,0 +1,65 @@
+From d9408b6cee9dc12c59e6fd31140e44c44d4b43b5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Oct 2022 17:08:21 +0000
+Subject: tcp: fix indefinite deferral of RTO with SACK reneging
+
+From: Neal Cardwell <ncardwell@google.com>
+
+[ Upstream commit 3d2af9cce3133b3bc596a9d065c6f9d93419ccfb ]
+
+This commit fixes a bug that can cause a TCP data sender to repeatedly
+defer RTOs when encountering SACK reneging.
+
+The bug is that when we're in fast recovery in a scenario with SACK
+reneging, every time we get an ACK we call tcp_check_sack_reneging()
+and it can note the apparent SACK reneging and rearm the RTO timer for
+srtt/2 into the future. In some SACK reneging scenarios that can
+happen repeatedly until the receive window fills up, at which point
+the sender can't send any more, the ACKs stop arriving, and the RTO
+fires at srtt/2 after the last ACK. But that can take far too long
+(O(10 secs)), since the connection is stuck in fast recovery with a
+low cwnd that cannot grow beyond ssthresh, even if more bandwidth is
+available.
+
+This fix changes the logic in tcp_check_sack_reneging() to only rearm
+the RTO timer if data is cumulatively ACKed, indicating forward
+progress. This avoids this kind of nearly infinite loop of RTO timer
+re-arming. In addition, this meets the goals of
+tcp_check_sack_reneging() in handling Windows TCP behavior that looks
+temporarily like SACK reneging but is not really.
+
+Many thanks to Jakub Kicinski and Neil Spring, who reported this issue
+and provided critical packet traces that enabled root-causing this
+issue. Also, many thanks to Jakub Kicinski for testing this fix.
+
+Fixes: 5ae344c949e7 ("tcp: reduce spurious retransmits due to transient SACK reneging")
+Reported-by: Jakub Kicinski <kuba@kernel.org>
+Reported-by: Neil Spring <ntspring@fb.com>
+Signed-off-by: Neal Cardwell <ncardwell@google.com>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Cc: Yuchung Cheng <ycheng@google.com>
+Tested-by: Jakub Kicinski <kuba@kernel.org>
+Link: https://lore.kernel.org/r/20221021170821.1093930-1-ncardwell.kernel@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_input.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
+index 686e210d89c2..102a0436eb29 100644
+--- a/net/ipv4/tcp_input.c
++++ b/net/ipv4/tcp_input.c
+@@ -2185,7 +2185,8 @@ void tcp_enter_loss(struct sock *sk)
+  */
+ static bool tcp_check_sack_reneging(struct sock *sk, int flag)
+ {
+-      if (flag & FLAG_SACK_RENEGING) {
++      if (flag & FLAG_SACK_RENEGING &&
++          flag & FLAG_SND_UNA_ADVANCED) {
+               struct tcp_sock *tp = tcp_sk(sk);
+               unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4),
+                                         msecs_to_jiffies(10));
+-- 
+2.35.1
+
diff --git a/queue-5.15/tcp-minor-optimization-in-tcp_add_backlog.patch b/queue-5.15/tcp-minor-optimization-in-tcp_add_backlog.patch
new file mode 100644 (file)
index 0000000..b723ed0
--- /dev/null
@@ -0,0 +1,46 @@
+From bfa41ae6caa67509dc1bc2444db04b9f29f95fc7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Nov 2021 11:02:30 -0800
+Subject: tcp: minor optimization in tcp_add_backlog()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit d519f350967a60b85a574ad8aeac43f2b4384746 ]
+
+If packet is going to be coalesced, sk_sndbuf/sk_rcvbuf values
+are not used. Defer their access to the point we need them.
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Stable-dep-of: ec791d8149ff ("tcp: fix a signed-integer-overflow bug in tcp_add_backlog()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_ipv4.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
+index 88a45d5650da..bae5c4ec5786 100644
+--- a/net/ipv4/tcp_ipv4.c
++++ b/net/ipv4/tcp_ipv4.c
+@@ -1808,8 +1808,7 @@ int tcp_v4_early_demux(struct sk_buff *skb)
+ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
+ {
+-      u32 limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf);
+-      u32 tail_gso_size, tail_gso_segs;
++      u32 limit, tail_gso_size, tail_gso_segs;
+       struct skb_shared_info *shinfo;
+       const struct tcphdr *th;
+       struct tcphdr *thtail;
+@@ -1917,7 +1916,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
+        * to reduce memory overhead, so add a little headroom here.
+        * Few sockets backlog are possibly concurrently non empty.
+        */
+-      limit += 64*1024;
++      limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf) + 64*1024;
+       if (unlikely(sk_add_backlog(sk, skb, limit))) {
+               bh_unlock_sock(sk);
+-- 
+2.35.1
+
diff --git a/queue-5.15/tipc-fix-a-null-ptr-deref-in-tipc_topsrv_accept.patch b/queue-5.15/tipc-fix-a-null-ptr-deref-in-tipc_topsrv_accept.patch
new file mode 100644 (file)
index 0000000..a388abb
--- /dev/null
@@ -0,0 +1,98 @@
+From cfe560a5638c3562dd44474fe9b2c6862f0fe04b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Oct 2022 15:19:50 -0400
+Subject: tipc: fix a null-ptr-deref in tipc_topsrv_accept
+
+From: Xin Long <lucien.xin@gmail.com>
+
+[ Upstream commit 82cb4e4612c633a9ce320e1773114875604a3cce ]
+
+syzbot found a crash in tipc_topsrv_accept:
+
+  KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
+  Workqueue: tipc_rcv tipc_topsrv_accept
+  RIP: 0010:kernel_accept+0x22d/0x350 net/socket.c:3487
+  Call Trace:
+   <TASK>
+   tipc_topsrv_accept+0x197/0x280 net/tipc/topsrv.c:460
+   process_one_work+0x991/0x1610 kernel/workqueue.c:2289
+   worker_thread+0x665/0x1080 kernel/workqueue.c:2436
+   kthread+0x2e4/0x3a0 kernel/kthread.c:376
+   ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
+
+It was caused by srv->listener that might be set to null by
+tipc_topsrv_stop() in net .exit whereas it's still used in
+tipc_topsrv_accept() worker.
+
+srv->listener is protected by srv->idr_lock in tipc_topsrv_stop(), so add
+a check for srv->listener under srv->idr_lock in tipc_topsrv_accept() to
+avoid the null-ptr-deref. To ensure the lsock is not released during the
+tipc_topsrv_accept(), move sock_release() after tipc_topsrv_work_stop()
+where it's waiting until the tipc_topsrv_accept worker to be done.
+
+Note that sk_callback_lock is used to protect sk->sk_user_data instead of
+srv->listener, and it should check srv in tipc_topsrv_listener_data_ready()
+instead. This also ensures that no more tipc_topsrv_accept worker will be
+started after tipc_conn_close() is called in tipc_topsrv_stop() where it
+sets sk->sk_user_data to null.
+
+Fixes: 0ef897be12b8 ("tipc: separate topology server listener socket from subcsriber sockets")
+Reported-by: syzbot+c5ce866a8d30f4be0651@syzkaller.appspotmail.com
+Signed-off-by: Xin Long <lucien.xin@gmail.com>
+Acked-by: Jon Maloy <jmaloy@redhat.com>
+Link: https://lore.kernel.org/r/4eee264380c409c61c6451af1059b7fb271a7e7b.1666120790.git.lucien.xin@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/tipc/topsrv.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
+index 14fd05fd6107..d92ec92f0b71 100644
+--- a/net/tipc/topsrv.c
++++ b/net/tipc/topsrv.c
+@@ -450,12 +450,19 @@ static void tipc_conn_data_ready(struct sock *sk)
+ static void tipc_topsrv_accept(struct work_struct *work)
+ {
+       struct tipc_topsrv *srv = container_of(work, struct tipc_topsrv, awork);
+-      struct socket *lsock = srv->listener;
+-      struct socket *newsock;
++      struct socket *newsock, *lsock;
+       struct tipc_conn *con;
+       struct sock *newsk;
+       int ret;
++      spin_lock_bh(&srv->idr_lock);
++      if (!srv->listener) {
++              spin_unlock_bh(&srv->idr_lock);
++              return;
++      }
++      lsock = srv->listener;
++      spin_unlock_bh(&srv->idr_lock);
++
+       while (1) {
+               ret = kernel_accept(lsock, &newsock, O_NONBLOCK);
+               if (ret < 0)
+@@ -489,7 +496,7 @@ static void tipc_topsrv_listener_data_ready(struct sock *sk)
+       read_lock_bh(&sk->sk_callback_lock);
+       srv = sk->sk_user_data;
+-      if (srv->listener)
++      if (srv)
+               queue_work(srv->rcv_wq, &srv->awork);
+       read_unlock_bh(&sk->sk_callback_lock);
+ }
+@@ -699,8 +706,9 @@ static void tipc_topsrv_stop(struct net *net)
+       __module_get(lsock->sk->sk_prot_creator->owner);
+       srv->listener = NULL;
+       spin_unlock_bh(&srv->idr_lock);
+-      sock_release(lsock);
++
+       tipc_topsrv_work_stop(srv);
++      sock_release(lsock);
+       idr_destroy(&srv->conn_idr);
+       kfree(srv);
+ }
+-- 
+2.35.1
+
diff --git a/queue-5.15/x86-unwind-orc-fix-unreliable-stack-dump-with-gcov.patch b/queue-5.15/x86-unwind-orc-fix-unreliable-stack-dump-with-gcov.patch
new file mode 100644 (file)
index 0000000..046695f
--- /dev/null
@@ -0,0 +1,80 @@
+From 26d8eae98a6d99f539ddada2caddff20882df61c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Jul 2022 11:15:06 +0800
+Subject: x86/unwind/orc: Fix unreliable stack dump with gcov
+
+From: Chen Zhongjin <chenzhongjin@huawei.com>
+
+[ Upstream commit 230db82413c091bc16acee72650f48d419cebe49 ]
+
+When a console stack dump is initiated with CONFIG_GCOV_PROFILE_ALL
+enabled, show_trace_log_lvl() gets out of sync with the ORC unwinder,
+causing the stack trace to show all text addresses as unreliable:
+
+  # echo l > /proc/sysrq-trigger
+  [  477.521031] sysrq: Show backtrace of all active CPUs
+  [  477.523813] NMI backtrace for cpu 0
+  [  477.524492] CPU: 0 PID: 1021 Comm: bash Not tainted 6.0.0 #65
+  [  477.525295] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-1.fc36 04/01/2014
+  [  477.526439] Call Trace:
+  [  477.526854]  <TASK>
+  [  477.527216]  ? dump_stack_lvl+0xc7/0x114
+  [  477.527801]  ? dump_stack+0x13/0x1f
+  [  477.528331]  ? nmi_cpu_backtrace.cold+0xb5/0x10d
+  [  477.528998]  ? lapic_can_unplug_cpu+0xa0/0xa0
+  [  477.529641]  ? nmi_trigger_cpumask_backtrace+0x16a/0x1f0
+  [  477.530393]  ? arch_trigger_cpumask_backtrace+0x1d/0x30
+  [  477.531136]  ? sysrq_handle_showallcpus+0x1b/0x30
+  [  477.531818]  ? __handle_sysrq.cold+0x4e/0x1ae
+  [  477.532451]  ? write_sysrq_trigger+0x63/0x80
+  [  477.533080]  ? proc_reg_write+0x92/0x110
+  [  477.533663]  ? vfs_write+0x174/0x530
+  [  477.534265]  ? handle_mm_fault+0x16f/0x500
+  [  477.534940]  ? ksys_write+0x7b/0x170
+  [  477.535543]  ? __x64_sys_write+0x1d/0x30
+  [  477.536191]  ? do_syscall_64+0x6b/0x100
+  [  477.536809]  ? entry_SYSCALL_64_after_hwframe+0x63/0xcd
+  [  477.537609]  </TASK>
+
+This happens when the compiled code for show_stack() has a single word
+on the stack, and doesn't use a tail call to show_stack_log_lvl().
+(CONFIG_GCOV_PROFILE_ALL=y is the only known case of this.)  Then the
+__unwind_start() skip logic hits an off-by-one bug and fails to unwind
+all the way to the intended starting frame.
+
+Fix it by reverting the following commit:
+
+  f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
+
+The original justification for that commit no longer exists.  That
+original issue was later fixed in a different way, with the following
+commit:
+
+  f2ac57a4c49d ("x86/unwind/orc: Fix inactive tasks with stack pointer in %sp on GCC 10 compiled kernels")
+
+Fixes: f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
+Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
+[jpoimboe: rewrite commit log]
+Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
+Signed-off-by: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/unwind_orc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
+index 3423aaea4ad8..8488966da5f1 100644
+--- a/arch/x86/kernel/unwind_orc.c
++++ b/arch/x86/kernel/unwind_orc.c
+@@ -700,7 +700,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,
+       /* Otherwise, skip ahead to the user-specified starting frame: */
+       while (!unwind_done(state) &&
+              (!on_stack(&state->stack_info, first_frame, sizeof(long)) ||
+-                      state->sp < (unsigned long)first_frame))
++                      state->sp <= (unsigned long)first_frame))
+               unwind_next_frame(state);
+       return;
+-- 
+2.35.1
+