]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.1
authorSasha Levin <sashal@kernel.org>
Sun, 15 Jun 2025 13:01:12 +0000 (09:01 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 15 Jun 2025 13:01:12 +0000 (09:01 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
40 files changed:
queue-6.1/acpi-cppc-fix-null-pointer-dereference-when-nosmp-is.patch [new file with mode: 0644]
queue-6.1/ath10k-snoc-fix-unbalanced-irq-enable-in-crash-recov.patch [new file with mode: 0644]
queue-6.1/bluetooth-fix-null-pointer-deference-on-eir_get_serv.patch [new file with mode: 0644]
queue-6.1/bluetooth-hci_core-fix-list_for_each_entry_rcu-usage.patch [new file with mode: 0644]
queue-6.1/bluetooth-hci_sync-fix-broadcast-pa-when-using-an-ex.patch [new file with mode: 0644]
queue-6.1/bluetooth-mgmt-fix-sparse-errors.patch [new file with mode: 0644]
queue-6.1/bluetooth-mgmt-fix-uaf-on-mgmt_remove_adv_monitor_co.patch [new file with mode: 0644]
queue-6.1/drm-meson-fix-debug-log-statement-when-setting-the-h.patch [new file with mode: 0644]
queue-6.1/drm-meson-fix-more-rounding-issues-with-59.94hz-mode.patch [new file with mode: 0644]
queue-6.1/drm-meson-use-unsigned-long-long-hz-for-frequency-ty.patch [new file with mode: 0644]
queue-6.1/drm-meson-use-vclk_freq-instead-of-pixel_freq-in-deb.patch [new file with mode: 0644]
queue-6.1/i40e-retry-vflr-handling-if-there-is-ongoing-vf-rese.patch [new file with mode: 0644]
queue-6.1/i40e-return-false-from-i40e_reset_vf-if-reset-is-in-.patch [new file with mode: 0644]
queue-6.1/macsec-macsec-sci-assignment-for-es-0.patch [new file with mode: 0644]
queue-6.1/net-fix-toctou-issue-in-sk_is_readable.patch [new file with mode: 0644]
queue-6.1/net-mdio-c22-is-now-optional-eopnotsupp-if-not-provi.patch [new file with mode: 0644]
queue-6.1/net-mdiobus-fix-potential-out-of-bounds-read-write-a.patch [new file with mode: 0644]
queue-6.1/net-mlx5-ensure-fw-pages-are-always-allocated-on-sam.patch [new file with mode: 0644]
queue-6.1/net-mlx5-fix-return-value-when-searching-for-existin.patch [new file with mode: 0644]
queue-6.1/net-mlx5e-fix-leak-of-geneve-tlv-option-object.patch [new file with mode: 0644]
queue-6.1/net_sched-ets-fix-a-race-in-ets_qdisc_change.patch [new file with mode: 0644]
queue-6.1/net_sched-prio-fix-a-race-in-prio_tune.patch [new file with mode: 0644]
queue-6.1/net_sched-red-fix-a-race-in-__red_change.patch [new file with mode: 0644]
queue-6.1/net_sched-sch_sfq-fix-a-potential-crash-on-gso_skb-h.patch [new file with mode: 0644]
queue-6.1/net_sched-tbf-fix-a-race-in-tbf_change.patch [new file with mode: 0644]
queue-6.1/pinctrl-qcom-pinctrl-qcm2290-add-missing-pins.patch [new file with mode: 0644]
queue-6.1/powerpc-powernv-memtrace-fix-out-of-bounds-issue-in-.patch [new file with mode: 0644]
queue-6.1/powerpc-vas-return-einval-if-the-offset-is-non-zero-.patch [new file with mode: 0644]
queue-6.1/ptp-remove-ptp-n_vclocks-check-logic-in-ptp_vclock_i.patch [new file with mode: 0644]
queue-6.1/regulator-max20086-fix-refcount-leak-in-max20086_par.patch [new file with mode: 0644]
queue-6.1/scsi-core-ufs-fix-a-hang-in-the-error-handler.patch [new file with mode: 0644]
queue-6.1/scsi-iscsi-fix-incorrect-error-path-labels-for-flash.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/wifi-ath11k-avoid-burning-cpu-in-ath11k_debugfs_fw_s.patch [new file with mode: 0644]
queue-6.1/wifi-ath11k-convert-timeouts-to-secs_to_jiffies.patch [new file with mode: 0644]
queue-6.1/wifi-ath11k-don-t-use-static-variables-in-ath11k_deb.patch [new file with mode: 0644]
queue-6.1/wifi-ath11k-don-t-wait-when-there-is-no-vdev-started.patch [new file with mode: 0644]
queue-6.1/wifi-ath11k-fix-soc_dp_stats-debugfs-file-permission.patch [new file with mode: 0644]
queue-6.1/wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch [new file with mode: 0644]
queue-6.1/wifi-ath11k-validate-ath11k_crypto_mode-on-top-of-at.patch [new file with mode: 0644]

diff --git a/queue-6.1/acpi-cppc-fix-null-pointer-dereference-when-nosmp-is.patch b/queue-6.1/acpi-cppc-fix-null-pointer-dereference-when-nosmp-is.patch
new file mode 100644 (file)
index 0000000..fc05e50
--- /dev/null
@@ -0,0 +1,48 @@
+From 1f0d30e5c9678eadf94739eb9bc088444cece3fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 4 Jun 2025 10:30:36 +0800
+Subject: ACPI: CPPC: Fix NULL pointer dereference when nosmp is used
+
+From: Yunhui Cui <cuiyunhui@bytedance.com>
+
+[ Upstream commit 15eece6c5b05e5f9db0711978c3e3b7f1a2cfe12 ]
+
+With nosmp in cmdline, other CPUs are not brought up, leaving
+their cpc_desc_ptr NULL. CPU0's iteration via for_each_possible_cpu()
+dereferences these NULL pointers, causing panic.
+
+Panic backtrace:
+
+[    0.401123] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000b8
+...
+[    0.403255] [<ffffffff809a5818>] cppc_allow_fast_switch+0x6a/0xd4
+...
+Kernel panic - not syncing: Attempted to kill init!
+
+Fixes: 3cc30dd00a58 ("cpufreq: CPPC: Enable fast_switch")
+Reported-by: Xu Lu <luxu.kernel@bytedance.com>
+Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
+Link: https://patch.msgid.link/20250604023036.99553-1-cuiyunhui@bytedance.com
+[ rjw: New subject ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/cppc_acpi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
+index 0e1fb97d5d763..504fe14c566e3 100644
+--- a/drivers/acpi/cppc_acpi.c
++++ b/drivers/acpi/cppc_acpi.c
+@@ -456,7 +456,7 @@ bool cppc_allow_fast_switch(void)
+       struct cpc_desc *cpc_ptr;
+       int cpu;
+-      for_each_possible_cpu(cpu) {
++      for_each_present_cpu(cpu) {
+               cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
+               desired_reg = &cpc_ptr->cpc_regs[DESIRED_PERF];
+               if (!CPC_IN_SYSTEM_MEMORY(desired_reg) &&
+-- 
+2.39.5
+
diff --git a/queue-6.1/ath10k-snoc-fix-unbalanced-irq-enable-in-crash-recov.patch b/queue-6.1/ath10k-snoc-fix-unbalanced-irq-enable-in-crash-recov.patch
new file mode 100644 (file)
index 0000000..11854d4
--- /dev/null
@@ -0,0 +1,49 @@
+From 7d1d20301d0cf4db4a9c1c445239c61c26986b61 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Mar 2025 20:50:27 +0000
+Subject: ath10k: snoc: fix unbalanced IRQ enable in crash recovery
+
+From: Caleb Connolly <caleb.connolly@linaro.org>
+
+[ Upstream commit 1650d32b92b01db03a1a95d69ee74fcbc34d4b00 ]
+
+In ath10k_snoc_hif_stop() we skip disabling the IRQs in the crash
+recovery flow, but we still unconditionally call enable again in
+ath10k_snoc_hif_start().
+
+We can't check the ATH10K_FLAG_CRASH_FLUSH bit since it is cleared
+before hif_start() is called, so instead check the
+ATH10K_SNOC_FLAG_RECOVERY flag and skip enabling the IRQs during crash
+recovery.
+
+This fixes unbalanced IRQ enable splats that happen after recovering from
+a crash.
+
+Fixes: 0e622f67e041 ("ath10k: add support for WCN3990 firmware crash recovery")
+Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
+Tested-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
+Link: https://patch.msgid.link/20250318205043.1043148-1-caleb.connolly@linaro.org
+Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath10k/snoc.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
+index 4b7266d928470..b43658b016844 100644
+--- a/drivers/net/wireless/ath/ath10k/snoc.c
++++ b/drivers/net/wireless/ath/ath10k/snoc.c
+@@ -936,7 +936,9 @@ static int ath10k_snoc_hif_start(struct ath10k *ar)
+       bitmap_clear(ar_snoc->pending_ce_irqs, 0, CE_COUNT_MAX);
+       ath10k_core_napi_enable(ar);
+-      ath10k_snoc_irq_enable(ar);
++      /* IRQs are left enabled when we restart due to a firmware crash */
++      if (!test_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags))
++              ath10k_snoc_irq_enable(ar);
+       ath10k_snoc_rx_post(ar);
+       clear_bit(ATH10K_SNOC_FLAG_RECOVERY, &ar_snoc->flags);
+-- 
+2.39.5
+
diff --git a/queue-6.1/bluetooth-fix-null-pointer-deference-on-eir_get_serv.patch b/queue-6.1/bluetooth-fix-null-pointer-deference-on-eir_get_serv.patch
new file mode 100644 (file)
index 0000000..8f9a88a
--- /dev/null
@@ -0,0 +1,50 @@
+From 7371bf2baba83bf95545f4ac345e7ac9b6f30fed Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 Jun 2025 11:14:25 -0400
+Subject: Bluetooth: Fix NULL pointer deference on eir_get_service_data
+
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+
+[ Upstream commit 20a2aa01f5aeb6daad9aeaa7c33dd512c58d81eb ]
+
+The len parameter is considered optional so it can be NULL so it cannot
+be used for skipping to next entry of EIR_SERVICE_DATA.
+
+Fixes: 8f9ae5b3ae80 ("Bluetooth: eir: Add helpers for managing service data")
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/eir.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/net/bluetooth/eir.c b/net/bluetooth/eir.c
+index 1bc51e2b05a34..3e1713673ecc9 100644
+--- a/net/bluetooth/eir.c
++++ b/net/bluetooth/eir.c
+@@ -366,17 +366,19 @@ u8 eir_create_scan_rsp(struct hci_dev *hdev, u8 instance, u8 *ptr)
+ void *eir_get_service_data(u8 *eir, size_t eir_len, u16 uuid, size_t *len)
+ {
+-      while ((eir = eir_get_data(eir, eir_len, EIR_SERVICE_DATA, len))) {
++      size_t dlen;
++
++      while ((eir = eir_get_data(eir, eir_len, EIR_SERVICE_DATA, &dlen))) {
+               u16 value = get_unaligned_le16(eir);
+               if (uuid == value) {
+                       if (len)
+-                              *len -= 2;
++                              *len = dlen - 2;
+                       return &eir[2];
+               }
+-              eir += *len;
+-              eir_len -= *len;
++              eir += dlen;
++              eir_len -= dlen;
+       }
+       return NULL;
+-- 
+2.39.5
+
diff --git a/queue-6.1/bluetooth-hci_core-fix-list_for_each_entry_rcu-usage.patch b/queue-6.1/bluetooth-hci_core-fix-list_for_each_entry_rcu-usage.patch
new file mode 100644 (file)
index 0000000..997418e
--- /dev/null
@@ -0,0 +1,57 @@
+From 1a07054cee3bb4d8790d3971a415e69f3d3f38a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 31 May 2025 18:24:58 +0300
+Subject: Bluetooth: hci_core: fix list_for_each_entry_rcu usage
+
+From: Pauli Virtanen <pav@iki.fi>
+
+[ Upstream commit 308a3a8ce8ea41b26c46169f3263e50f5997c28e ]
+
+Releasing + re-acquiring RCU lock inside list_for_each_entry_rcu() loop
+body is not correct.
+
+Fix by taking the update-side hdev->lock instead.
+
+Fixes: c7eaf80bfb0c ("Bluetooth: Fix hci_link_tx_to RCU lock usage")
+Signed-off-by: Pauli Virtanen <pav@iki.fi>
+Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/hci_core.c | 11 +++--------
+ 1 file changed, 3 insertions(+), 8 deletions(-)
+
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index 3cd7c212375fc..dc53e3078ba79 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -3402,23 +3402,18 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type)
+       bt_dev_err(hdev, "link tx timeout");
+-      rcu_read_lock();
++      hci_dev_lock(hdev);
+       /* Kill stalled connections */
+-      list_for_each_entry_rcu(c, &h->list, list) {
++      list_for_each_entry(c, &h->list, list) {
+               if (c->type == type && c->sent) {
+                       bt_dev_err(hdev, "killing stalled connection %pMR",
+                                  &c->dst);
+-                      /* hci_disconnect might sleep, so, we have to release
+-                       * the RCU read lock before calling it.
+-                       */
+-                      rcu_read_unlock();
+                       hci_disconnect(c, HCI_ERROR_REMOTE_USER_TERM);
+-                      rcu_read_lock();
+               }
+       }
+-      rcu_read_unlock();
++      hci_dev_unlock(hdev);
+ }
+ static struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
+-- 
+2.39.5
+
diff --git a/queue-6.1/bluetooth-hci_sync-fix-broadcast-pa-when-using-an-ex.patch b/queue-6.1/bluetooth-hci_sync-fix-broadcast-pa-when-using-an-ex.patch
new file mode 100644 (file)
index 0000000..415b801
--- /dev/null
@@ -0,0 +1,105 @@
+From 30d0f8763403f534b706863c4e5de220732f9802 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 Jun 2025 11:15:16 -0400
+Subject: Bluetooth: hci_sync: Fix broadcast/PA when using an existing instance
+
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+
+[ Upstream commit 5725bc608252050ed8a4d47d59225b7dd73474c8 ]
+
+When using and existing adv_info instance for broadcast source it
+needs to be updated to periodic first before it can be reused, also in
+case the existing instance already have data hci_set_adv_instance_data
+cannot be used directly since it would overwrite the existing data so
+this reappend the original data after the Broadcast ID, if one was
+generated.
+
+Example:
+
+bluetoothctl># Add PBP to EA so it can be later referenced as the BIS ID
+bluetoothctl> advertise.service 0x1856 0x00 0x00
+bluetoothctl> advertise on
+...
+< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 13
+        Handle: 0x01
+        Operation: Complete extended advertising data (0x03)
+        Fragment preference: Minimize fragmentation (0x01)
+        Data length: 0x09
+        Service Data: Public Broadcast Announcement (0x1856)
+          Data[2]: 0000
+        Flags: 0x06
+          LE General Discoverable Mode
+          BR/EDR Not Supported
+...
+bluetoothctl># Attempt to acquire Broadcast Source transport
+bluetoothctl>transport.acquire /org/bluez/hci0/pac_bcast0/fd0
+...
+< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 255
+        Handle: 0x01
+        Operation: Complete extended advertising data (0x03)
+        Fragment preference: Minimize fragmentation (0x01)
+        Data length: 0x0e
+        Service Data: Broadcast Audio Announcement (0x1852)
+        Broadcast ID: 11371620 (0xad8464)
+        Service Data: Public Broadcast Announcement (0x1856)
+          Data[2]: 0000
+        Flags: 0x06
+          LE General Discoverable Mode
+          BR/EDR Not Supported
+
+Link: https://github.com/bluez/bluez/issues/1117
+Fixes: eca0ae4aea66 ("Bluetooth: Add initial implementation of BIS connections")
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/hci_sync.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
+index c6108e68f5a91..bb4420cbc096b 100644
+--- a/net/bluetooth/hci_sync.c
++++ b/net/bluetooth/hci_sync.c
+@@ -1539,7 +1539,8 @@ static int hci_enable_per_advertising_sync(struct hci_dev *hdev, u8 instance)
+ static int hci_adv_bcast_annoucement(struct hci_dev *hdev, struct adv_info *adv)
+ {
+       u8 bid[3];
+-      u8 ad[4 + 3];
++      u8 ad[HCI_MAX_EXT_AD_LENGTH];
++      u8 len;
+       /* Skip if NULL adv as instance 0x00 is used for general purpose
+        * advertising so it cannot used for the likes of Broadcast Announcement
+@@ -1565,8 +1566,10 @@ static int hci_adv_bcast_annoucement(struct hci_dev *hdev, struct adv_info *adv)
+       /* Generate Broadcast ID */
+       get_random_bytes(bid, sizeof(bid));
+-      eir_append_service_data(ad, 0, 0x1852, bid, sizeof(bid));
+-      hci_set_adv_instance_data(hdev, adv->instance, sizeof(ad), ad, 0, NULL);
++      len = eir_append_service_data(ad, 0, 0x1852, bid, sizeof(bid));
++      memcpy(ad + len, adv->adv_data, adv->adv_data_len);
++      hci_set_adv_instance_data(hdev, adv->instance, len + adv->adv_data_len,
++                                ad, 0, NULL);
+       return hci_update_adv_data_sync(hdev, adv->instance);
+ }
+@@ -1583,8 +1586,15 @@ int hci_start_per_adv_sync(struct hci_dev *hdev, u8 instance, u8 data_len,
+       if (instance) {
+               adv = hci_find_adv_instance(hdev, instance);
+-              /* Create an instance if that could not be found */
+-              if (!adv) {
++              if (adv) {
++                      /* Turn it into periodic advertising */
++                      adv->periodic = true;
++                      adv->per_adv_data_len = data_len;
++                      if (data)
++                              memcpy(adv->per_adv_data, data, data_len);
++                      adv->flags = flags;
++              } else if (!adv) {
++                      /* Create an instance if that could not be found */
+                       adv = hci_add_per_instance(hdev, instance, flags,
+                                                  data_len, data,
+                                                  sync_interval,
+-- 
+2.39.5
+
diff --git a/queue-6.1/bluetooth-mgmt-fix-sparse-errors.patch b/queue-6.1/bluetooth-mgmt-fix-sparse-errors.patch
new file mode 100644 (file)
index 0000000..e0822ef
--- /dev/null
@@ -0,0 +1,47 @@
+From 9cc46621caec4e055e33728923847493638013a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Jun 2025 16:36:27 -0400
+Subject: Bluetooth: MGMT: Fix sparse errors
+
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+
+[ Upstream commit 7dd38ba4acbea9875b4ee061e20a26413e39d9f4 ]
+
+This fixes the following errors:
+
+net/bluetooth/mgmt.c:5400:59: sparse: sparse: incorrect type in argument 3
+(different base types) @@     expected unsigned short [usertype] handle @@
+got restricted __le16 [usertype] monitor_handle @@
+net/bluetooth/mgmt.c:5400:59: sparse:     expected unsigned short [usertype] handle
+net/bluetooth/mgmt.c:5400:59: sparse:     got restricted __le16 [usertype] monitor_handle
+
+Fixes: e6ed54e86aae ("Bluetooth: MGMT: Fix UAF on mgmt_remove_adv_monitor_complete")
+Reported-by: kernel test robot <lkp@intel.com>
+Closes: https://lore.kernel.org/oe-kbuild-all/202506060347.ux2O1p7L-lkp@intel.com/
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/mgmt.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
+index 123cf62e3c000..08bb78ba988d8 100644
+--- a/net/bluetooth/mgmt.c
++++ b/net/bluetooth/mgmt.c
+@@ -5237,11 +5237,11 @@ static void mgmt_adv_monitor_added(struct sock *sk, struct hci_dev *hdev,
+ }
+ static void mgmt_adv_monitor_removed(struct sock *sk, struct hci_dev *hdev,
+-                                   u16 handle)
++                                   __le16 handle)
+ {
+       struct mgmt_ev_adv_monitor_removed ev;
+-      ev.monitor_handle = cpu_to_le16(handle);
++      ev.monitor_handle = handle;
+       mgmt_event(MGMT_EV_ADV_MONITOR_REMOVED, hdev, &ev, sizeof(ev), sk);
+ }
+-- 
+2.39.5
+
diff --git a/queue-6.1/bluetooth-mgmt-fix-uaf-on-mgmt_remove_adv_monitor_co.patch b/queue-6.1/bluetooth-mgmt-fix-uaf-on-mgmt_remove_adv_monitor_co.patch
new file mode 100644 (file)
index 0000000..288bd8a
--- /dev/null
@@ -0,0 +1,229 @@
+From 43716d12f67ecb14cb5b125eb0c626e6979a233f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Jun 2025 16:12:39 -0400
+Subject: Bluetooth: MGMT: Fix UAF on mgmt_remove_adv_monitor_complete
+
+From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+
+[ Upstream commit e6ed54e86aae9e4f7286ce8d5c73780f91b48d1c ]
+
+This reworks MGMT_OP_REMOVE_ADV_MONITOR to not use mgmt_pending_add to
+avoid crashes like bellow:
+
+==================================================================
+BUG: KASAN: slab-use-after-free in mgmt_remove_adv_monitor_complete+0xe5/0x540 net/bluetooth/mgmt.c:5406
+Read of size 8 at addr ffff88801c53f318 by task kworker/u5:5/5341
+
+CPU: 0 UID: 0 PID: 5341 Comm: kworker/u5:5 Not tainted 6.15.0-syzkaller-10402-g4cb6c8af8591 #0 PREEMPT(full)
+Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
+Workqueue: hci0 hci_cmd_sync_work
+Call Trace:
+ <TASK>
+ dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
+ print_address_description mm/kasan/report.c:408 [inline]
+ print_report+0xd2/0x2b0 mm/kasan/report.c:521
+ kasan_report+0x118/0x150 mm/kasan/report.c:634
+ mgmt_remove_adv_monitor_complete+0xe5/0x540 net/bluetooth/mgmt.c:5406
+ hci_cmd_sync_work+0x261/0x3a0 net/bluetooth/hci_sync.c:334
+ process_one_work kernel/workqueue.c:3238 [inline]
+ process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321
+ worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
+ kthread+0x711/0x8a0 kernel/kthread.c:464
+ ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
+ ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
+ </TASK>
+
+Allocated by task 5987:
+ kasan_save_stack mm/kasan/common.c:47 [inline]
+ kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
+ poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
+ __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394
+ kasan_kmalloc include/linux/kasan.h:260 [inline]
+ __kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4358
+ kmalloc_noprof include/linux/slab.h:905 [inline]
+ kzalloc_noprof include/linux/slab.h:1039 [inline]
+ mgmt_pending_new+0x65/0x240 net/bluetooth/mgmt_util.c:252
+ mgmt_pending_add+0x34/0x120 net/bluetooth/mgmt_util.c:279
+ remove_adv_monitor+0x103/0x1b0 net/bluetooth/mgmt.c:5454
+ hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719
+ hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839
+ sock_sendmsg_nosec net/socket.c:712 [inline]
+ __sock_sendmsg+0x219/0x270 net/socket.c:727
+ sock_write_iter+0x258/0x330 net/socket.c:1131
+ new_sync_write fs/read_write.c:593 [inline]
+ vfs_write+0x548/0xa90 fs/read_write.c:686
+ ksys_write+0x145/0x250 fs/read_write.c:738
+ do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
+ do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+
+Freed by task 5989:
+ kasan_save_stack mm/kasan/common.c:47 [inline]
+ kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
+ kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576
+ poison_slab_object mm/kasan/common.c:247 [inline]
+ __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264
+ kasan_slab_free include/linux/kasan.h:233 [inline]
+ slab_free_hook mm/slub.c:2380 [inline]
+ slab_free mm/slub.c:4642 [inline]
+ kfree+0x18e/0x440 mm/slub.c:4841
+ mgmt_pending_foreach+0xc9/0x120 net/bluetooth/mgmt_util.c:242
+ mgmt_index_removed+0x10d/0x2f0 net/bluetooth/mgmt.c:9366
+ hci_sock_bind+0xbe9/0x1000 net/bluetooth/hci_sock.c:1314
+ __sys_bind_socket net/socket.c:1810 [inline]
+ __sys_bind+0x2c3/0x3e0 net/socket.c:1841
+ __do_sys_bind net/socket.c:1846 [inline]
+ __se_sys_bind net/socket.c:1844 [inline]
+ __x64_sys_bind+0x7a/0x90 net/socket.c:1844
+ do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
+ do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+
+Fixes: 66bd095ab5d4 ("Bluetooth: advmon offload MSFT remove monitor")
+Closes: https://syzkaller.appspot.com/bug?extid=feb0dc579bbe30a13190
+Reported-by: syzbot+feb0dc579bbe30a13190@syzkaller.appspotmail.com
+Tested-by: syzbot+feb0dc579bbe30a13190@syzkaller.appspotmail.com
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/bluetooth/hci_core.h |  1 -
+ net/bluetooth/hci_core.c         |  4 +---
+ net/bluetooth/mgmt.c             | 37 ++++++++++----------------------
+ 3 files changed, 12 insertions(+), 30 deletions(-)
+
+diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
+index d26b57e87f7f4..97cde23f56ecd 100644
+--- a/include/net/bluetooth/hci_core.h
++++ b/include/net/bluetooth/hci_core.h
+@@ -2125,7 +2125,6 @@ void mgmt_advertising_added(struct sock *sk, struct hci_dev *hdev,
+                           u8 instance);
+ void mgmt_advertising_removed(struct sock *sk, struct hci_dev *hdev,
+                             u8 instance);
+-void mgmt_adv_monitor_removed(struct hci_dev *hdev, u16 handle);
+ int mgmt_phy_configuration_changed(struct hci_dev *hdev, struct sock *skip);
+ void mgmt_adv_monitor_device_lost(struct hci_dev *hdev, u16 handle,
+                                 bdaddr_t *bdaddr, u8 addr_type);
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index dc53e3078ba79..a26323400bf53 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -1873,10 +1873,8 @@ void hci_free_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)
+       if (monitor->handle)
+               idr_remove(&hdev->adv_monitors_idr, monitor->handle);
+-      if (monitor->state != ADV_MONITOR_STATE_NOT_REGISTERED) {
++      if (monitor->state != ADV_MONITOR_STATE_NOT_REGISTERED)
+               hdev->adv_monitors_cnt--;
+-              mgmt_adv_monitor_removed(hdev, monitor->handle);
+-      }
+       kfree(monitor);
+ }
+diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
+index 27bd8c8ddeb02..123cf62e3c000 100644
+--- a/net/bluetooth/mgmt.c
++++ b/net/bluetooth/mgmt.c
+@@ -5236,24 +5236,14 @@ static void mgmt_adv_monitor_added(struct sock *sk, struct hci_dev *hdev,
+       mgmt_event(MGMT_EV_ADV_MONITOR_ADDED, hdev, &ev, sizeof(ev), sk);
+ }
+-void mgmt_adv_monitor_removed(struct hci_dev *hdev, u16 handle)
++static void mgmt_adv_monitor_removed(struct sock *sk, struct hci_dev *hdev,
++                                   u16 handle)
+ {
+       struct mgmt_ev_adv_monitor_removed ev;
+-      struct mgmt_pending_cmd *cmd;
+-      struct sock *sk_skip = NULL;
+-      struct mgmt_cp_remove_adv_monitor *cp;
+-
+-      cmd = pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev);
+-      if (cmd) {
+-              cp = cmd->param;
+-
+-              if (cp->monitor_handle)
+-                      sk_skip = cmd->sk;
+-      }
+       ev.monitor_handle = cpu_to_le16(handle);
+-      mgmt_event(MGMT_EV_ADV_MONITOR_REMOVED, hdev, &ev, sizeof(ev), sk_skip);
++      mgmt_event(MGMT_EV_ADV_MONITOR_REMOVED, hdev, &ev, sizeof(ev), sk);
+ }
+ static int read_adv_mon_features(struct sock *sk, struct hci_dev *hdev,
+@@ -5355,8 +5345,7 @@ static int __add_adv_patterns_monitor(struct sock *sk, struct hci_dev *hdev,
+       if (pending_find(MGMT_OP_SET_LE, hdev) ||
+           pending_find(MGMT_OP_ADD_ADV_PATTERNS_MONITOR, hdev) ||
+-          pending_find(MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI, hdev) ||
+-          pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev)) {
++          pending_find(MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI, hdev)) {
+               status = MGMT_STATUS_BUSY;
+               goto unlock;
+       }
+@@ -5526,8 +5515,7 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
+       struct mgmt_pending_cmd *cmd = data;
+       struct mgmt_cp_remove_adv_monitor *cp;
+-      if (status == -ECANCELED ||
+-          cmd != pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev))
++      if (status == -ECANCELED)
+               return;
+       hci_dev_lock(hdev);
+@@ -5536,12 +5524,14 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
+       rp.monitor_handle = cp->monitor_handle;
+-      if (!status)
++      if (!status) {
++              mgmt_adv_monitor_removed(cmd->sk, hdev, cp->monitor_handle);
+               hci_update_passive_scan(hdev);
++      }
+       mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode,
+                         mgmt_status(status), &rp, sizeof(rp));
+-      mgmt_pending_remove(cmd);
++      mgmt_pending_free(cmd);
+       hci_dev_unlock(hdev);
+       bt_dev_dbg(hdev, "remove monitor %d complete, status %d",
+@@ -5551,10 +5541,6 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
+ static int mgmt_remove_adv_monitor_sync(struct hci_dev *hdev, void *data)
+ {
+       struct mgmt_pending_cmd *cmd = data;
+-
+-      if (cmd != pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev))
+-              return -ECANCELED;
+-
+       struct mgmt_cp_remove_adv_monitor *cp = cmd->param;
+       u16 handle = __le16_to_cpu(cp->monitor_handle);
+@@ -5573,14 +5559,13 @@ static int remove_adv_monitor(struct sock *sk, struct hci_dev *hdev,
+       hci_dev_lock(hdev);
+       if (pending_find(MGMT_OP_SET_LE, hdev) ||
+-          pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev) ||
+           pending_find(MGMT_OP_ADD_ADV_PATTERNS_MONITOR, hdev) ||
+           pending_find(MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI, hdev)) {
+               status = MGMT_STATUS_BUSY;
+               goto unlock;
+       }
+-      cmd = mgmt_pending_add(sk, MGMT_OP_REMOVE_ADV_MONITOR, hdev, data, len);
++      cmd = mgmt_pending_new(sk, MGMT_OP_REMOVE_ADV_MONITOR, hdev, data, len);
+       if (!cmd) {
+               status = MGMT_STATUS_NO_RESOURCES;
+               goto unlock;
+@@ -5590,7 +5575,7 @@ static int remove_adv_monitor(struct sock *sk, struct hci_dev *hdev,
+                                 mgmt_remove_adv_monitor_complete);
+       if (err) {
+-              mgmt_pending_remove(cmd);
++              mgmt_pending_free(cmd);
+               if (err == -ENOMEM)
+                       status = MGMT_STATUS_NO_RESOURCES;
+-- 
+2.39.5
+
diff --git a/queue-6.1/drm-meson-fix-debug-log-statement-when-setting-the-h.patch b/queue-6.1/drm-meson-fix-debug-log-statement-when-setting-the-h.patch
new file mode 100644 (file)
index 0000000..d4c1dbe
--- /dev/null
@@ -0,0 +1,39 @@
+From 75417ec3a0df3913707e5fbb76898feb98e58172 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Jun 2025 22:37:29 +0200
+Subject: drm/meson: fix debug log statement when setting the HDMI clocks
+
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+
+[ Upstream commit d17e61ab63fb7747b340d6a66bf1408cd5c6562b ]
+
+The "phy" and "vclk" frequency labels were swapped, making it more
+difficult to debug driver errors. Swap the label order to make them
+match with the actual frequencies printed to correct this.
+
+Fixes: e5fab2ec9ca4 ("drm/meson: vclk: add support for YUV420 setup")
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
+Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
+Link: https://lore.kernel.org/r/20250606203729.3311592-1-martin.blumenstingl@googlemail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+index c1401ec1354d1..e34dc1e405882 100644
+--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
++++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+@@ -106,7 +106,7 @@ static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder_hdmi,
+               venc_freq /= 2;
+       dev_dbg(priv->dev,
+-              "vclk:%lluHz phy=%lluHz venc=%lluHz hdmi=%lluHz enci=%d\n",
++              "phy:%lluHz vclk=%lluHz venc=%lluHz hdmi=%lluHz enci=%d\n",
+               phy_freq, vclk_freq, venc_freq, hdmi_freq,
+               priv->venc.hdmi_use_enci);
+-- 
+2.39.5
+
diff --git a/queue-6.1/drm-meson-fix-more-rounding-issues-with-59.94hz-mode.patch b/queue-6.1/drm-meson-fix-more-rounding-issues-with-59.94hz-mode.patch
new file mode 100644 (file)
index 0000000..6805005
--- /dev/null
@@ -0,0 +1,134 @@
+From b75dda77413555bb4d5b7cadf6cc29af5980bcd8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Jun 2025 22:27:51 +0200
+Subject: drm/meson: fix more rounding issues with 59.94Hz modes
+
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+
+[ Upstream commit 0cee6c4d3518b2e757aedae78771f17149f57653 ]
+
+Commit 1017560164b6 ("drm/meson: use unsigned long long / Hz for
+frequency types") attempts to resolve video playback using 59.94Hz.
+ using YUV420 by changing the clock calculation to use
+Hz instead of kHz (thus yielding more precision).
+
+The basic calculation itself is correct, however the comparisions in
+meson_vclk_vic_supported_freq() and meson_vclk_setup() don't work
+anymore for 59.94Hz modes (using the freq * 1000 / 1001 logic). For
+example, drm/edid specifies a 593407kHz clock for 3840x2160@59.94Hz.
+With the mentioend commit we convert this to Hz. Then meson_vclk
+tries to find a matchig "params" entry (as the clock setup code
+currently only supports specific frequencies) by taking the venc_freq
+from the params and calculating the "alt frequency" (used for the
+59.94Hz modes) from it, which is:
+  (594000000Hz * 1000) / 1001 = 593406593Hz
+
+Similar calculation is applied to the phy_freq (TMDS clock), which is 10
+times the pixel clock.
+
+Implement a new meson_vclk_freqs_are_matching_param() function whose
+purpose is to compare if the requested and calculated frequencies. They
+may not match exactly (for the reasons mentioned above). Allow the
+clocks to deviate slightly to make the 59.94Hz modes again.
+
+Fixes: 1017560164b6 ("drm/meson: use unsigned long long / Hz for frequency types")
+Reported-by: Christian Hewitt <christianshewitt@gmail.com>
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
+Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
+Link: https://lore.kernel.org/r/20250609202751.962208-1-martin.blumenstingl@googlemail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/meson/meson_vclk.c | 55 ++++++++++++++++++------------
+ 1 file changed, 34 insertions(+), 21 deletions(-)
+
+diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
+index c4123bb958e4c..dfe0c28a0f054 100644
+--- a/drivers/gpu/drm/meson/meson_vclk.c
++++ b/drivers/gpu/drm/meson/meson_vclk.c
+@@ -110,10 +110,7 @@
+ #define HDMI_PLL_LOCK         BIT(31)
+ #define HDMI_PLL_LOCK_G12A    (3 << 30)
+-#define PIXEL_FREQ_1000_1001(_freq)   \
+-      DIV_ROUND_CLOSEST_ULL((_freq) * 1000ULL, 1001ULL)
+-#define PHY_FREQ_1000_1001(_freq)     \
+-      (PIXEL_FREQ_1000_1001(DIV_ROUND_DOWN_ULL(_freq, 10ULL)) * 10)
++#define FREQ_1000_1001(_freq) DIV_ROUND_CLOSEST_ULL((_freq) * 1000ULL, 1001ULL)
+ /* VID PLL Dividers */
+ enum {
+@@ -772,6 +769,36 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv,
+                 pll_freq);
+ }
++static bool meson_vclk_freqs_are_matching_param(unsigned int idx,
++                                              unsigned long long phy_freq,
++                                              unsigned long long vclk_freq)
++{
++      DRM_DEBUG_DRIVER("i = %d vclk_freq = %lluHz alt = %lluHz\n",
++                       idx, params[idx].vclk_freq,
++                       FREQ_1000_1001(params[idx].vclk_freq));
++      DRM_DEBUG_DRIVER("i = %d phy_freq = %lluHz alt = %lluHz\n",
++                       idx, params[idx].phy_freq,
++                       FREQ_1000_1001(params[idx].phy_freq));
++
++      /* Match strict frequency */
++      if (phy_freq == params[idx].phy_freq &&
++          vclk_freq == params[idx].vclk_freq)
++              return true;
++
++      /* Match 1000/1001 variant: vclk deviation has to be less than 1kHz
++       * (drm EDID is defined in 1kHz steps, so everything smaller must be
++       * rounding error) and the PHY freq deviation has to be less than
++       * 10kHz (as the TMDS clock is 10 times the pixel clock, so anything
++       * smaller must be rounding error as well).
++       */
++      if (abs(vclk_freq - FREQ_1000_1001(params[idx].vclk_freq)) < 1000 &&
++          abs(phy_freq - FREQ_1000_1001(params[idx].phy_freq)) < 10000)
++              return true;
++
++      /* no match */
++      return false;
++}
++
+ enum drm_mode_status
+ meson_vclk_vic_supported_freq(struct meson_drm *priv,
+                             unsigned long long phy_freq,
+@@ -790,19 +817,7 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv,
+       }
+       for (i = 0 ; params[i].pixel_freq ; ++i) {
+-              DRM_DEBUG_DRIVER("i = %d vclk_freq = %lluHz alt = %lluHz\n",
+-                               i, params[i].vclk_freq,
+-                               PIXEL_FREQ_1000_1001(params[i].vclk_freq));
+-              DRM_DEBUG_DRIVER("i = %d phy_freq = %lluHz alt = %lluHz\n",
+-                               i, params[i].phy_freq,
+-                               PHY_FREQ_1000_1001(params[i].phy_freq));
+-              /* Match strict frequency */
+-              if (phy_freq == params[i].phy_freq &&
+-                  vclk_freq == params[i].vclk_freq)
+-                      return MODE_OK;
+-              /* Match 1000/1001 variant */
+-              if (phy_freq == PHY_FREQ_1000_1001(params[i].phy_freq) &&
+-                  vclk_freq == PIXEL_FREQ_1000_1001(params[i].vclk_freq))
++              if (meson_vclk_freqs_are_matching_param(i, phy_freq, vclk_freq))
+                       return MODE_OK;
+       }
+@@ -1075,10 +1090,8 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
+       }
+       for (freq = 0 ; params[freq].pixel_freq ; ++freq) {
+-              if ((phy_freq == params[freq].phy_freq ||
+-                   phy_freq == PHY_FREQ_1000_1001(params[freq].phy_freq)) &&
+-                  (vclk_freq == params[freq].vclk_freq ||
+-                   vclk_freq == PIXEL_FREQ_1000_1001(params[freq].vclk_freq))) {
++              if (meson_vclk_freqs_are_matching_param(freq, phy_freq,
++                                                      vclk_freq)) {
+                       if (vclk_freq != params[freq].vclk_freq)
+                               vic_alternate_clock = true;
+                       else
+-- 
+2.39.5
+
diff --git a/queue-6.1/drm-meson-use-unsigned-long-long-hz-for-frequency-ty.patch b/queue-6.1/drm-meson-use-unsigned-long-long-hz-for-frequency-ty.patch
new file mode 100644 (file)
index 0000000..13b1906
--- /dev/null
@@ -0,0 +1,649 @@
+From 8eb4ff5de4704de5a6d192d6931193f2d6b21e56 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 21 Apr 2025 22:13:00 +0200
+Subject: drm/meson: use unsigned long long / Hz for frequency types
+
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+
+[ Upstream commit 1017560164b6bbcbc93579266926e6e96675262a ]
+
+Christian reports that 4K output using YUV420 encoding fails with the
+following error:
+  Fatal Error, invalid HDMI vclk freq 593406
+
+Modetest shows the following:
+  3840x2160 59.94 3840 4016 4104 4400 2160 2168 2178 2250 593407 flags: xxxx, xxxx,
+  drm calculated value -------------------------------------^
+
+This indicates that there's a (1kHz) mismatch between the clock
+calculated by the drm framework and the meson driver.
+
+Relevant function call stack:
+(drm framework)
+  -> meson_encoder_hdmi_atomic_enable()
+    -> meson_encoder_hdmi_set_vclk()
+      -> meson_vclk_setup()
+
+The video clock requested by the drm framework is 593407kHz. This is
+passed by meson_encoder_hdmi_atomic_enable() to
+meson_encoder_hdmi_set_vclk() and the following formula is applied:
+- the frequency is halved (which would be 296703.5kHz) and rounded down
+  to the next full integer, which is 296703kHz
+- TMDS clock is calculated (296703kHz * 10)
+- video encoder clock is calculated - this needs to match a table from
+  meson_vclk.c and so it doubles the previously halved value again
+  (resulting in 593406kHz)
+- meson_vclk_setup() can't find (either directly, or by deriving it from
+  594000kHz * 1000 / 1001 and rounding to the closest integer value -
+  which is 593407kHz as originally requested by the drm framework) a
+  matching clock in it's internal table and errors out with "invalid
+  HDMI vclk freq"
+
+Fix the division precision by switching the whole meson driver to use
+unsigned long long (64-bit) Hz values for clock frequencies instead of
+unsigned int (32-bit) kHz to fix the rouding error.
+
+Fixes: e5fab2ec9ca4 ("drm/meson: vclk: add support for YUV420 setup")
+Reported-by: Christian Hewitt <christianshewitt@gmail.com>
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
+Link: https://lore.kernel.org/r/20250421201300.778955-3-martin.blumenstingl@googlemail.com
+Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
+Link: https://lore.kernel.org/r/20250421201300.778955-3-martin.blumenstingl@googlemail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/meson/meson_drv.c          |   2 +-
+ drivers/gpu/drm/meson/meson_drv.h          |   2 +-
+ drivers/gpu/drm/meson/meson_encoder_hdmi.c |  29 +--
+ drivers/gpu/drm/meson/meson_vclk.c         | 195 +++++++++++----------
+ drivers/gpu/drm/meson/meson_vclk.h         |  13 +-
+ 5 files changed, 126 insertions(+), 115 deletions(-)
+
+diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
+index f0df41cf39a36..5606a248f4c48 100644
+--- a/drivers/gpu/drm/meson/meson_drv.c
++++ b/drivers/gpu/drm/meson/meson_drv.c
+@@ -167,7 +167,7 @@ static const struct meson_drm_soc_attr meson_drm_soc_attrs[] = {
+       /* S805X/S805Y HDMI PLL won't lock for HDMI PHY freq > 1,65GHz */
+       {
+               .limits = {
+-                      .max_hdmi_phy_freq = 1650000,
++                      .max_hdmi_phy_freq = 1650000000,
+               },
+               .attrs = (const struct soc_device_attribute []) {
+                       { .soc_id = "GXL (S805*)", },
+diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h
+index c62ee358456fa..3b03282f1e2b9 100644
+--- a/drivers/gpu/drm/meson/meson_drv.h
++++ b/drivers/gpu/drm/meson/meson_drv.h
+@@ -37,7 +37,7 @@ struct meson_drm_match_data {
+ };
+ struct meson_drm_soc_limits {
+-      unsigned int max_hdmi_phy_freq;
++      unsigned long long max_hdmi_phy_freq;
+ };
+ struct meson_drm {
+diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+index 03062e7a02b64..c1401ec1354d1 100644
+--- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
++++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
+@@ -68,12 +68,12 @@ static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder_hdmi,
+ {
+       struct meson_drm *priv = encoder_hdmi->priv;
+       int vic = drm_match_cea_mode(mode);
+-      unsigned int phy_freq;
+-      unsigned int vclk_freq;
+-      unsigned int venc_freq;
+-      unsigned int hdmi_freq;
++      unsigned long long phy_freq;
++      unsigned long long vclk_freq;
++      unsigned long long venc_freq;
++      unsigned long long hdmi_freq;
+-      vclk_freq = mode->clock;
++      vclk_freq = mode->clock * 1000;
+       /* For 420, pixel clock is half unlike venc clock */
+       if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24)
+@@ -105,7 +105,8 @@ static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder_hdmi,
+       if (mode->flags & DRM_MODE_FLAG_DBLCLK)
+               venc_freq /= 2;
+-      dev_dbg(priv->dev, "vclk:%d phy=%d venc=%d hdmi=%d enci=%d\n",
++      dev_dbg(priv->dev,
++              "vclk:%lluHz phy=%lluHz venc=%lluHz hdmi=%lluHz enci=%d\n",
+               phy_freq, vclk_freq, venc_freq, hdmi_freq,
+               priv->venc.hdmi_use_enci);
+@@ -120,10 +121,11 @@ static enum drm_mode_status meson_encoder_hdmi_mode_valid(struct drm_bridge *bri
+       struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);
+       struct meson_drm *priv = encoder_hdmi->priv;
+       bool is_hdmi2_sink = display_info->hdmi.scdc.supported;
+-      unsigned int phy_freq;
+-      unsigned int vclk_freq;
+-      unsigned int venc_freq;
+-      unsigned int hdmi_freq;
++      unsigned long long clock = mode->clock * 1000;
++      unsigned long long phy_freq;
++      unsigned long long vclk_freq;
++      unsigned long long venc_freq;
++      unsigned long long hdmi_freq;
+       int vic = drm_match_cea_mode(mode);
+       enum drm_mode_status status;
+@@ -142,12 +144,12 @@ static enum drm_mode_status meson_encoder_hdmi_mode_valid(struct drm_bridge *bri
+               if (status != MODE_OK)
+                       return status;
+-              return meson_vclk_dmt_supported_freq(priv, mode->clock);
++              return meson_vclk_dmt_supported_freq(priv, clock);
+       /* Check against supported VIC modes */
+       } else if (!meson_venc_hdmi_supported_vic(vic))
+               return MODE_BAD;
+-      vclk_freq = mode->clock;
++      vclk_freq = clock;
+       /* For 420, pixel clock is half unlike venc clock */
+       if (drm_mode_is_420_only(display_info, mode) ||
+@@ -177,7 +179,8 @@ static enum drm_mode_status meson_encoder_hdmi_mode_valid(struct drm_bridge *bri
+       if (mode->flags & DRM_MODE_FLAG_DBLCLK)
+               venc_freq /= 2;
+-      dev_dbg(priv->dev, "%s: vclk:%d phy=%d venc=%d hdmi=%d\n",
++      dev_dbg(priv->dev,
++              "%s: vclk:%lluHz phy=%lluHz venc=%lluHz hdmi=%lluHz\n",
+               __func__, phy_freq, vclk_freq, venc_freq, hdmi_freq);
+       return meson_vclk_vic_supported_freq(priv, phy_freq, vclk_freq);
+diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
+index 2a82119eb58ed..3325580d885d0 100644
+--- a/drivers/gpu/drm/meson/meson_vclk.c
++++ b/drivers/gpu/drm/meson/meson_vclk.c
+@@ -110,7 +110,10 @@
+ #define HDMI_PLL_LOCK         BIT(31)
+ #define HDMI_PLL_LOCK_G12A    (3 << 30)
+-#define FREQ_1000_1001(_freq) DIV_ROUND_CLOSEST(_freq * 1000, 1001)
++#define PIXEL_FREQ_1000_1001(_freq)   \
++      DIV_ROUND_CLOSEST_ULL((_freq) * 1000ULL, 1001ULL)
++#define PHY_FREQ_1000_1001(_freq)     \
++      (PIXEL_FREQ_1000_1001(DIV_ROUND_DOWN_ULL(_freq, 10ULL)) * 10)
+ /* VID PLL Dividers */
+ enum {
+@@ -360,11 +363,11 @@ enum {
+ };
+ struct meson_vclk_params {
+-      unsigned int pll_freq;
+-      unsigned int phy_freq;
+-      unsigned int vclk_freq;
+-      unsigned int venc_freq;
+-      unsigned int pixel_freq;
++      unsigned long long pll_freq;
++      unsigned long long phy_freq;
++      unsigned long long vclk_freq;
++      unsigned long long venc_freq;
++      unsigned long long pixel_freq;
+       unsigned int pll_od1;
+       unsigned int pll_od2;
+       unsigned int pll_od3;
+@@ -372,11 +375,11 @@ struct meson_vclk_params {
+       unsigned int vclk_div;
+ } params[] = {
+       [MESON_VCLK_HDMI_ENCI_54000] = {
+-              .pll_freq = 4320000,
+-              .phy_freq = 270000,
+-              .vclk_freq = 54000,
+-              .venc_freq = 54000,
+-              .pixel_freq = 54000,
++              .pll_freq = 4320000000,
++              .phy_freq = 270000000,
++              .vclk_freq = 54000000,
++              .venc_freq = 54000000,
++              .pixel_freq = 54000000,
+               .pll_od1 = 4,
+               .pll_od2 = 4,
+               .pll_od3 = 1,
+@@ -384,11 +387,11 @@ struct meson_vclk_params {
+               .vclk_div = 1,
+       },
+       [MESON_VCLK_HDMI_DDR_54000] = {
+-              .pll_freq = 4320000,
+-              .phy_freq = 270000,
+-              .vclk_freq = 54000,
+-              .venc_freq = 54000,
+-              .pixel_freq = 27000,
++              .pll_freq = 4320000000,
++              .phy_freq = 270000000,
++              .vclk_freq = 54000000,
++              .venc_freq = 54000000,
++              .pixel_freq = 27000000,
+               .pll_od1 = 4,
+               .pll_od2 = 4,
+               .pll_od3 = 1,
+@@ -396,11 +399,11 @@ struct meson_vclk_params {
+               .vclk_div = 1,
+       },
+       [MESON_VCLK_HDMI_DDR_148500] = {
+-              .pll_freq = 2970000,
+-              .phy_freq = 742500,
+-              .vclk_freq = 148500,
+-              .venc_freq = 148500,
+-              .pixel_freq = 74250,
++              .pll_freq = 2970000000,
++              .phy_freq = 742500000,
++              .vclk_freq = 148500000,
++              .venc_freq = 148500000,
++              .pixel_freq = 74250000,
+               .pll_od1 = 4,
+               .pll_od2 = 1,
+               .pll_od3 = 1,
+@@ -408,11 +411,11 @@ struct meson_vclk_params {
+               .vclk_div = 1,
+       },
+       [MESON_VCLK_HDMI_74250] = {
+-              .pll_freq = 2970000,
+-              .phy_freq = 742500,
+-              .vclk_freq = 74250,
+-              .venc_freq = 74250,
+-              .pixel_freq = 74250,
++              .pll_freq = 2970000000,
++              .phy_freq = 742500000,
++              .vclk_freq = 74250000,
++              .venc_freq = 74250000,
++              .pixel_freq = 74250000,
+               .pll_od1 = 2,
+               .pll_od2 = 2,
+               .pll_od3 = 2,
+@@ -420,11 +423,11 @@ struct meson_vclk_params {
+               .vclk_div = 1,
+       },
+       [MESON_VCLK_HDMI_148500] = {
+-              .pll_freq = 2970000,
+-              .phy_freq = 1485000,
+-              .vclk_freq = 148500,
+-              .venc_freq = 148500,
+-              .pixel_freq = 148500,
++              .pll_freq = 2970000000,
++              .phy_freq = 1485000000,
++              .vclk_freq = 148500000,
++              .venc_freq = 148500000,
++              .pixel_freq = 148500000,
+               .pll_od1 = 1,
+               .pll_od2 = 2,
+               .pll_od3 = 2,
+@@ -432,11 +435,11 @@ struct meson_vclk_params {
+               .vclk_div = 1,
+       },
+       [MESON_VCLK_HDMI_297000] = {
+-              .pll_freq = 5940000,
+-              .phy_freq = 2970000,
+-              .venc_freq = 297000,
+-              .vclk_freq = 297000,
+-              .pixel_freq = 297000,
++              .pll_freq = 5940000000,
++              .phy_freq = 2970000000,
++              .venc_freq = 297000000,
++              .vclk_freq = 297000000,
++              .pixel_freq = 297000000,
+               .pll_od1 = 2,
+               .pll_od2 = 1,
+               .pll_od3 = 1,
+@@ -444,11 +447,11 @@ struct meson_vclk_params {
+               .vclk_div = 2,
+       },
+       [MESON_VCLK_HDMI_594000] = {
+-              .pll_freq = 5940000,
+-              .phy_freq = 5940000,
+-              .venc_freq = 594000,
+-              .vclk_freq = 594000,
+-              .pixel_freq = 594000,
++              .pll_freq = 5940000000,
++              .phy_freq = 5940000000,
++              .venc_freq = 594000000,
++              .vclk_freq = 594000000,
++              .pixel_freq = 594000000,
+               .pll_od1 = 1,
+               .pll_od2 = 1,
+               .pll_od3 = 2,
+@@ -456,11 +459,11 @@ struct meson_vclk_params {
+               .vclk_div = 1,
+       },
+       [MESON_VCLK_HDMI_594000_YUV420] = {
+-              .pll_freq = 5940000,
+-              .phy_freq = 2970000,
+-              .venc_freq = 594000,
+-              .vclk_freq = 594000,
+-              .pixel_freq = 297000,
++              .pll_freq = 5940000000,
++              .phy_freq = 2970000000,
++              .venc_freq = 594000000,
++              .vclk_freq = 594000000,
++              .pixel_freq = 297000000,
+               .pll_od1 = 2,
+               .pll_od2 = 1,
+               .pll_od3 = 1,
+@@ -617,16 +620,16 @@ static void meson_hdmi_pll_set_params(struct meson_drm *priv, unsigned int m,
+                               3 << 20, pll_od_to_reg(od3) << 20);
+ }
+-#define XTAL_FREQ 24000
++#define XTAL_FREQ (24 * 1000 * 1000)
+ static unsigned int meson_hdmi_pll_get_m(struct meson_drm *priv,
+-                                       unsigned int pll_freq)
++                                       unsigned long long pll_freq)
+ {
+       /* The GXBB PLL has a /2 pre-multiplier */
+       if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB))
+-              pll_freq /= 2;
++              pll_freq = DIV_ROUND_DOWN_ULL(pll_freq, 2);
+-      return pll_freq / XTAL_FREQ;
++      return DIV_ROUND_DOWN_ULL(pll_freq, XTAL_FREQ);
+ }
+ #define HDMI_FRAC_MAX_GXBB    4096
+@@ -635,12 +638,13 @@ static unsigned int meson_hdmi_pll_get_m(struct meson_drm *priv,
+ static unsigned int meson_hdmi_pll_get_frac(struct meson_drm *priv,
+                                           unsigned int m,
+-                                          unsigned int pll_freq)
++                                          unsigned long long pll_freq)
+ {
+-      unsigned int parent_freq = XTAL_FREQ;
++      unsigned long long parent_freq = XTAL_FREQ;
+       unsigned int frac_max = HDMI_FRAC_MAX_GXL;
+       unsigned int frac_m;
+       unsigned int frac;
++      u32 remainder;
+       /* The GXBB PLL has a /2 pre-multiplier and a larger FRAC width */
+       if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB)) {
+@@ -652,11 +656,11 @@ static unsigned int meson_hdmi_pll_get_frac(struct meson_drm *priv,
+               frac_max = HDMI_FRAC_MAX_G12A;
+       /* We can have a perfect match !*/
+-      if (pll_freq / m == parent_freq &&
+-          pll_freq % m == 0)
++      if (div_u64_rem(pll_freq, m, &remainder) == parent_freq &&
++          remainder == 0)
+               return 0;
+-      frac = div_u64((u64)pll_freq * (u64)frac_max, parent_freq);
++      frac = mul_u64_u64_div_u64(pll_freq, frac_max, parent_freq);
+       frac_m = m * frac_max;
+       if (frac_m > frac)
+               return frac_max;
+@@ -666,7 +670,7 @@ static unsigned int meson_hdmi_pll_get_frac(struct meson_drm *priv,
+ }
+ static bool meson_hdmi_pll_validate_params(struct meson_drm *priv,
+-                                         unsigned int m,
++                                         unsigned long long m,
+                                          unsigned int frac)
+ {
+       if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB)) {
+@@ -694,7 +698,7 @@ static bool meson_hdmi_pll_validate_params(struct meson_drm *priv,
+ }
+ static bool meson_hdmi_pll_find_params(struct meson_drm *priv,
+-                                     unsigned int freq,
++                                     unsigned long long freq,
+                                      unsigned int *m,
+                                      unsigned int *frac,
+                                      unsigned int *od)
+@@ -706,7 +710,7 @@ static bool meson_hdmi_pll_find_params(struct meson_drm *priv,
+                       continue;
+               *frac = meson_hdmi_pll_get_frac(priv, *m, freq * *od);
+-              DRM_DEBUG_DRIVER("PLL params for %dkHz: m=%x frac=%x od=%d\n",
++              DRM_DEBUG_DRIVER("PLL params for %lluHz: m=%x frac=%x od=%d\n",
+                                freq, *m, *frac, *od);
+               if (meson_hdmi_pll_validate_params(priv, *m, *frac))
+@@ -718,7 +722,7 @@ static bool meson_hdmi_pll_find_params(struct meson_drm *priv,
+ /* pll_freq is the frequency after the OD dividers */
+ enum drm_mode_status
+-meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned int freq)
++meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned long long freq)
+ {
+       unsigned int od, m, frac;
+@@ -741,7 +745,7 @@ EXPORT_SYMBOL_GPL(meson_vclk_dmt_supported_freq);
+ /* pll_freq is the frequency after the OD dividers */
+ static void meson_hdmi_pll_generic_set(struct meson_drm *priv,
+-                                     unsigned int pll_freq)
++                                     unsigned long long pll_freq)
+ {
+       unsigned int od, m, frac, od1, od2, od3;
+@@ -756,7 +760,7 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv,
+                       od1 = od / od2;
+               }
+-              DRM_DEBUG_DRIVER("PLL params for %dkHz: m=%x frac=%x od=%d/%d/%d\n",
++              DRM_DEBUG_DRIVER("PLL params for %lluHz: m=%x frac=%x od=%d/%d/%d\n",
+                                pll_freq, m, frac, od1, od2, od3);
+               meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
+@@ -764,17 +768,18 @@ static void meson_hdmi_pll_generic_set(struct meson_drm *priv,
+               return;
+       }
+-      DRM_ERROR("Fatal, unable to find parameters for PLL freq %d\n",
++      DRM_ERROR("Fatal, unable to find parameters for PLL freq %lluHz\n",
+                 pll_freq);
+ }
+ enum drm_mode_status
+-meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq,
+-                            unsigned int vclk_freq)
++meson_vclk_vic_supported_freq(struct meson_drm *priv,
++                            unsigned long long phy_freq,
++                            unsigned long long vclk_freq)
+ {
+       int i;
+-      DRM_DEBUG_DRIVER("phy_freq = %d vclk_freq = %d\n",
++      DRM_DEBUG_DRIVER("phy_freq = %lluHz vclk_freq = %lluHz\n",
+                        phy_freq, vclk_freq);
+       /* Check against soc revision/package limits */
+@@ -785,19 +790,19 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq,
+       }
+       for (i = 0 ; params[i].pixel_freq ; ++i) {
+-              DRM_DEBUG_DRIVER("i = %d pixel_freq = %d alt = %d\n",
++              DRM_DEBUG_DRIVER("i = %d pixel_freq = %lluHz alt = %lluHz\n",
+                                i, params[i].pixel_freq,
+-                               FREQ_1000_1001(params[i].pixel_freq));
+-              DRM_DEBUG_DRIVER("i = %d phy_freq = %d alt = %d\n",
++                               PIXEL_FREQ_1000_1001(params[i].pixel_freq));
++              DRM_DEBUG_DRIVER("i = %d phy_freq = %lluHz alt = %lluHz\n",
+                                i, params[i].phy_freq,
+-                               FREQ_1000_1001(params[i].phy_freq/10)*10);
++                               PHY_FREQ_1000_1001(params[i].phy_freq));
+               /* Match strict frequency */
+               if (phy_freq == params[i].phy_freq &&
+                   vclk_freq == params[i].vclk_freq)
+                       return MODE_OK;
+               /* Match 1000/1001 variant */
+-              if (phy_freq == (FREQ_1000_1001(params[i].phy_freq/10)*10) &&
+-                  vclk_freq == FREQ_1000_1001(params[i].vclk_freq))
++              if (phy_freq == PHY_FREQ_1000_1001(params[i].phy_freq) &&
++                  vclk_freq == PIXEL_FREQ_1000_1001(params[i].vclk_freq))
+                       return MODE_OK;
+       }
+@@ -805,8 +810,9 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq,
+ }
+ EXPORT_SYMBOL_GPL(meson_vclk_vic_supported_freq);
+-static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
+-                         unsigned int od1, unsigned int od2, unsigned int od3,
++static void meson_vclk_set(struct meson_drm *priv,
++                         unsigned long long pll_base_freq, unsigned int od1,
++                         unsigned int od2, unsigned int od3,
+                          unsigned int vid_pll_div, unsigned int vclk_div,
+                          unsigned int hdmi_tx_div, unsigned int venc_div,
+                          bool hdmi_use_enci, bool vic_alternate_clock)
+@@ -826,15 +832,15 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
+               meson_hdmi_pll_generic_set(priv, pll_base_freq);
+       } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXBB)) {
+               switch (pll_base_freq) {
+-              case 2970000:
++              case 2970000000:
+                       m = 0x3d;
+                       frac = vic_alternate_clock ? 0xd02 : 0xe00;
+                       break;
+-              case 4320000:
++              case 4320000000:
+                       m = vic_alternate_clock ? 0x59 : 0x5a;
+                       frac = vic_alternate_clock ? 0xe8f : 0;
+                       break;
+-              case 5940000:
++              case 5940000000:
+                       m = 0x7b;
+                       frac = vic_alternate_clock ? 0xa05 : 0xc00;
+                       break;
+@@ -844,15 +850,15 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
+       } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) ||
+                  meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL)) {
+               switch (pll_base_freq) {
+-              case 2970000:
++              case 2970000000:
+                       m = 0x7b;
+                       frac = vic_alternate_clock ? 0x281 : 0x300;
+                       break;
+-              case 4320000:
++              case 4320000000:
+                       m = vic_alternate_clock ? 0xb3 : 0xb4;
+                       frac = vic_alternate_clock ? 0x347 : 0;
+                       break;
+-              case 5940000:
++              case 5940000000:
+                       m = 0xf7;
+                       frac = vic_alternate_clock ? 0x102 : 0x200;
+                       break;
+@@ -861,15 +867,15 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
+               meson_hdmi_pll_set_params(priv, m, frac, od1, od2, od3);
+       } else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) {
+               switch (pll_base_freq) {
+-              case 2970000:
++              case 2970000000:
+                       m = 0x7b;
+                       frac = vic_alternate_clock ? 0x140b4 : 0x18000;
+                       break;
+-              case 4320000:
++              case 4320000000:
+                       m = vic_alternate_clock ? 0xb3 : 0xb4;
+                       frac = vic_alternate_clock ? 0x1a3ee : 0;
+                       break;
+-              case 5940000:
++              case 5940000000:
+                       m = 0xf7;
+                       frac = vic_alternate_clock ? 0x8148 : 0x10000;
+                       break;
+@@ -1025,14 +1031,14 @@ static void meson_vclk_set(struct meson_drm *priv, unsigned int pll_base_freq,
+ }
+ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
+-                    unsigned int phy_freq, unsigned int vclk_freq,
+-                    unsigned int venc_freq, unsigned int dac_freq,
++                    unsigned long long phy_freq, unsigned long long vclk_freq,
++                    unsigned long long venc_freq, unsigned long long dac_freq,
+                     bool hdmi_use_enci)
+ {
+       bool vic_alternate_clock = false;
+-      unsigned int freq;
+-      unsigned int hdmi_tx_div;
+-      unsigned int venc_div;
++      unsigned long long freq;
++      unsigned long long hdmi_tx_div;
++      unsigned long long venc_div;
+       if (target == MESON_VCLK_TARGET_CVBS) {
+               meson_venci_cvbs_clock_config(priv);
+@@ -1052,27 +1058,27 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
+               return;
+       }
+-      hdmi_tx_div = vclk_freq / dac_freq;
++      hdmi_tx_div = DIV_ROUND_DOWN_ULL(vclk_freq, dac_freq);
+       if (hdmi_tx_div == 0) {
+-              pr_err("Fatal Error, invalid HDMI-TX freq %d\n",
++              pr_err("Fatal Error, invalid HDMI-TX freq %lluHz\n",
+                      dac_freq);
+               return;
+       }
+-      venc_div = vclk_freq / venc_freq;
++      venc_div = DIV_ROUND_DOWN_ULL(vclk_freq, venc_freq);
+       if (venc_div == 0) {
+-              pr_err("Fatal Error, invalid HDMI venc freq %d\n",
++              pr_err("Fatal Error, invalid HDMI venc freq %lluHz\n",
+                      venc_freq);
+               return;
+       }
+       for (freq = 0 ; params[freq].pixel_freq ; ++freq) {
+               if ((phy_freq == params[freq].phy_freq ||
+-                   phy_freq == FREQ_1000_1001(params[freq].phy_freq/10)*10) &&
++                   phy_freq == PHY_FREQ_1000_1001(params[freq].phy_freq)) &&
+                   (vclk_freq == params[freq].vclk_freq ||
+-                   vclk_freq == FREQ_1000_1001(params[freq].vclk_freq))) {
++                   vclk_freq == PIXEL_FREQ_1000_1001(params[freq].vclk_freq))) {
+                       if (vclk_freq != params[freq].vclk_freq)
+                               vic_alternate_clock = true;
+                       else
+@@ -1098,7 +1104,8 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
+       }
+       if (!params[freq].pixel_freq) {
+-              pr_err("Fatal Error, invalid HDMI vclk freq %d\n", vclk_freq);
++              pr_err("Fatal Error, invalid HDMI vclk freq %lluHz\n",
++                     vclk_freq);
+               return;
+       }
+diff --git a/drivers/gpu/drm/meson/meson_vclk.h b/drivers/gpu/drm/meson/meson_vclk.h
+index 60617aaf18dd1..7ac55744e5749 100644
+--- a/drivers/gpu/drm/meson/meson_vclk.h
++++ b/drivers/gpu/drm/meson/meson_vclk.h
+@@ -20,17 +20,18 @@ enum {
+ };
+ /* 27MHz is the CVBS Pixel Clock */
+-#define MESON_VCLK_CVBS                       27000
++#define MESON_VCLK_CVBS                       (27 * 1000 * 1000)
+ enum drm_mode_status
+-meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned int freq);
++meson_vclk_dmt_supported_freq(struct meson_drm *priv, unsigned long long freq);
+ enum drm_mode_status
+-meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq,
+-                            unsigned int vclk_freq);
++meson_vclk_vic_supported_freq(struct meson_drm *priv,
++                            unsigned long long phy_freq,
++                            unsigned long long vclk_freq);
+ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,
+-                    unsigned int phy_freq, unsigned int vclk_freq,
+-                    unsigned int venc_freq, unsigned int dac_freq,
++                    unsigned long long phy_freq, unsigned long long vclk_freq,
++                    unsigned long long venc_freq, unsigned long long dac_freq,
+                     bool hdmi_use_enci);
+ #endif /* __MESON_VCLK_H */
+-- 
+2.39.5
+
diff --git a/queue-6.1/drm-meson-use-vclk_freq-instead-of-pixel_freq-in-deb.patch b/queue-6.1/drm-meson-use-vclk_freq-instead-of-pixel_freq-in-deb.patch
new file mode 100644 (file)
index 0000000..d1be8f9
--- /dev/null
@@ -0,0 +1,46 @@
+From 59a1daeece11975f4916e23837137f296c4b80f8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 7 Jun 2025 00:10:31 +0200
+Subject: drm/meson: use vclk_freq instead of pixel_freq in debug print
+
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+
+[ Upstream commit faf2f8382088e8c74bd6eeb236c8c9190e61615e ]
+
+meson_vclk_vic_supported_freq() has a debug print which includes the
+pixel freq. However, within the whole function the pixel freq is
+irrelevant, other than checking the end of the params array. Switch to
+printing the vclk_freq which is being compared / matched against the
+inputs to the function to avoid confusion when analyzing error reports
+from users.
+
+Fixes: e5fab2ec9ca4 ("drm/meson: vclk: add support for YUV420 setup")
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
+Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
+Link: https://lore.kernel.org/r/20250606221031.3419353-1-martin.blumenstingl@googlemail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/meson/meson_vclk.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/meson/meson_vclk.c b/drivers/gpu/drm/meson/meson_vclk.c
+index 3325580d885d0..c4123bb958e4c 100644
+--- a/drivers/gpu/drm/meson/meson_vclk.c
++++ b/drivers/gpu/drm/meson/meson_vclk.c
+@@ -790,9 +790,9 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv,
+       }
+       for (i = 0 ; params[i].pixel_freq ; ++i) {
+-              DRM_DEBUG_DRIVER("i = %d pixel_freq = %lluHz alt = %lluHz\n",
+-                               i, params[i].pixel_freq,
+-                               PIXEL_FREQ_1000_1001(params[i].pixel_freq));
++              DRM_DEBUG_DRIVER("i = %d vclk_freq = %lluHz alt = %lluHz\n",
++                               i, params[i].vclk_freq,
++                               PIXEL_FREQ_1000_1001(params[i].vclk_freq));
+               DRM_DEBUG_DRIVER("i = %d phy_freq = %lluHz alt = %lluHz\n",
+                                i, params[i].phy_freq,
+                                PHY_FREQ_1000_1001(params[i].phy_freq));
+-- 
+2.39.5
+
diff --git a/queue-6.1/i40e-retry-vflr-handling-if-there-is-ongoing-vf-rese.patch b/queue-6.1/i40e-retry-vflr-handling-if-there-is-ongoing-vf-rese.patch
new file mode 100644 (file)
index 0000000..0385565
--- /dev/null
@@ -0,0 +1,44 @@
+From e6de64ed8c4ec1d03efdc92d1850842e22695d3a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 20 May 2025 10:31:52 +0200
+Subject: i40e: retry VFLR handling if there is ongoing VF reset
+
+From: Robert Malz <robert.malz@canonical.com>
+
+[ Upstream commit fb4e9239e029954a37a00818b21e837cebf2aa10 ]
+
+When a VFLR interrupt is received during a VF reset initiated from a
+different source, the VFLR may be not fully handled. This can
+leave the VF in an undefined state.
+To address this, set the I40E_VFLR_EVENT_PENDING bit again during VFLR
+handling if the reset is not yet complete. This ensures the driver
+will properly complete the VF reset in such scenarios.
+
+Fixes: 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")
+Signed-off-by: Robert Malz <robert.malz@canonical.com>
+Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+index 87d74b54a3337..ff4f1c4f3829b 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+@@ -4267,7 +4267,10 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
+               reg = rd32(hw, I40E_GLGEN_VFLRSTAT(reg_idx));
+               if (reg & BIT(bit_idx))
+                       /* i40e_reset_vf will clear the bit in GLGEN_VFLRSTAT */
+-                      i40e_reset_vf(vf, true);
++                      if (!i40e_reset_vf(vf, true)) {
++                              /* At least one VF did not finish resetting, retry next time */
++                              set_bit(__I40E_VFLR_EVENT_PENDING, pf->state);
++                      }
+       }
+       return 0;
+-- 
+2.39.5
+
diff --git a/queue-6.1/i40e-return-false-from-i40e_reset_vf-if-reset-is-in-.patch b/queue-6.1/i40e-return-false-from-i40e_reset_vf-if-reset-is-in-.patch
new file mode 100644 (file)
index 0000000..e7f13d3
--- /dev/null
@@ -0,0 +1,55 @@
+From a21ce281689f4c8cc03fce720451071794214746 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 20 May 2025 10:31:51 +0200
+Subject: i40e: return false from i40e_reset_vf if reset is in progress
+
+From: Robert Malz <robert.malz@canonical.com>
+
+[ Upstream commit a2c90d63b71223d69a813333c1abf4fdacddbbe5 ]
+
+The function i40e_vc_reset_vf attempts, up to 20 times, to handle a
+VF reset request, using the return value of i40e_reset_vf as an indicator
+of whether the reset was successfully triggered. Currently, i40e_reset_vf
+always returns true, which causes new reset requests to be ignored if a
+different VF reset is already in progress.
+
+This patch updates the return value of i40e_reset_vf to reflect when
+another VF reset is in progress, allowing the caller to properly use
+the retry mechanism.
+
+Fixes: 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")
+Signed-off-by: Robert Malz <robert.malz@canonical.com>
+Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+index 11e9858cc86a0..87d74b54a3337 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+@@ -1548,8 +1548,8 @@ static void i40e_cleanup_reset_vf(struct i40e_vf *vf)
+  * @vf: pointer to the VF structure
+  * @flr: VFLR was issued or not
+  *
+- * Returns true if the VF is in reset, resets successfully, or resets
+- * are disabled and false otherwise.
++ * Return: True if reset was performed successfully or if resets are disabled.
++ * False if reset is already in progress.
+  **/
+ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
+ {
+@@ -1568,7 +1568,7 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
+       /* 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;
++              return false;
+       i40e_trigger_vf_reset(vf, flr);
+-- 
+2.39.5
+
diff --git a/queue-6.1/macsec-macsec-sci-assignment-for-es-0.patch b/queue-6.1/macsec-macsec-sci-assignment-for-es-0.patch
new file mode 100644 (file)
index 0000000..ae5cd8f
--- /dev/null
@@ -0,0 +1,128 @@
+From 1d3a139a4b747b3839634a7df7ab864102342d7e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Jun 2025 09:26:26 +0200
+Subject: macsec: MACsec SCI assignment for ES = 0
+
+From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
+
+[ Upstream commit d9816ec74e6d6aa29219d010bba3f780ba1d9d75 ]
+
+According to 802.1AE standard, when ES and SC flags in TCI are zero,
+used SCI should be the current active SC_RX. Current code uses the
+header MAC address. Without this patch, when ES flag is 0 (using a
+bridge or switch), header MAC will not fit the SCI and MACSec frames
+will be discarted.
+
+In order to test this issue, MACsec link should be stablished between
+two interfaces, setting SC and ES flags to zero and a port identifier
+different than one. For example, using ip macsec tools:
+
+ip link add link $ETH0 macsec0 type macsec port 11 send_sci off
+end_station off
+ip macsec add macsec0 tx sa 0 pn 2 on key 01 $ETH1_KEY
+ip macsec add macsec0 rx port 11 address $ETH1_MAC
+ip macsec add macsec0 rx port 11 address $ETH1_MAC sa 0 pn 2 on key 02
+ip link set dev macsec0 up
+
+ip link add link $ETH1 macsec1 type macsec port 11 send_sci off
+end_station off
+ip macsec add macsec1 tx sa 0 pn 2 on key 01 $ETH0_KEY
+ip macsec add macsec1 rx port 11 address $ETH0_MAC
+ip macsec add macsec1 rx port 11 address $ETH0_MAC sa 0 pn 2 on key 02
+ip link set dev macsec1 up
+
+Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
+Co-developed-by: Andreu Montiel <Andreu.Montiel@technica-engineering.de>
+Signed-off-by: Andreu Montiel <Andreu.Montiel@technica-engineering.de>
+Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
+Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/macsec.c | 40 ++++++++++++++++++++++++++++++++++------
+ 1 file changed, 34 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
+index c007e262daf7d..e954b46ebe86b 100644
+--- a/drivers/net/macsec.c
++++ b/drivers/net/macsec.c
+@@ -243,15 +243,39 @@ static sci_t make_sci(const u8 *addr, __be16 port)
+       return sci;
+ }
+-static sci_t macsec_frame_sci(struct macsec_eth_header *hdr, bool sci_present)
++static sci_t macsec_active_sci(struct macsec_secy *secy)
+ {
+-      sci_t sci;
++      struct macsec_rx_sc *rx_sc = rcu_dereference_bh(secy->rx_sc);
++
++      /* Case single RX SC */
++      if (rx_sc && !rcu_dereference_bh(rx_sc->next))
++              return (rx_sc->active) ? rx_sc->sci : 0;
++      /* Case no RX SC or multiple */
++      else
++              return 0;
++}
++
++static sci_t macsec_frame_sci(struct macsec_eth_header *hdr, bool sci_present,
++                            struct macsec_rxh_data *rxd)
++{
++      struct macsec_dev *macsec;
++      sci_t sci = 0;
+-      if (sci_present)
++      /* SC = 1 */
++      if (sci_present) {
+               memcpy(&sci, hdr->secure_channel_id,
+                      sizeof(hdr->secure_channel_id));
+-      else
++      /* SC = 0; ES = 0 */
++      } else if ((!(hdr->tci_an & (MACSEC_TCI_ES | MACSEC_TCI_SC))) &&
++                 (list_is_singular(&rxd->secys))) {
++              /* Only one SECY should exist on this scenario */
++              macsec = list_first_or_null_rcu(&rxd->secys, struct macsec_dev,
++                                              secys);
++              if (macsec)
++                      return macsec_active_sci(&macsec->secy);
++      } else {
+               sci = make_sci(hdr->eth.h_source, MACSEC_PORT_ES);
++      }
+       return sci;
+ }
+@@ -1110,7 +1134,7 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
+       struct macsec_rxh_data *rxd;
+       struct macsec_dev *macsec;
+       unsigned int len;
+-      sci_t sci;
++      sci_t sci = 0;
+       u32 hdr_pn;
+       bool cbit;
+       struct pcpu_rx_sc_stats *rxsc_stats;
+@@ -1157,11 +1181,14 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
+       macsec_skb_cb(skb)->has_sci = !!(hdr->tci_an & MACSEC_TCI_SC);
+       macsec_skb_cb(skb)->assoc_num = hdr->tci_an & MACSEC_AN_MASK;
+-      sci = macsec_frame_sci(hdr, macsec_skb_cb(skb)->has_sci);
+       rcu_read_lock();
+       rxd = macsec_data_rcu(skb->dev);
++      sci = macsec_frame_sci(hdr, macsec_skb_cb(skb)->has_sci, rxd);
++      if (!sci)
++              goto drop_nosc;
++
+       list_for_each_entry_rcu(macsec, &rxd->secys, secys) {
+               struct macsec_rx_sc *sc = find_rx_sc(&macsec->secy, sci);
+@@ -1284,6 +1311,7 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
+       macsec_rxsa_put(rx_sa);
+ drop_nosa:
+       macsec_rxsc_put(rx_sc);
++drop_nosc:
+       rcu_read_unlock();
+ drop_direct:
+       kfree_skb(skb);
+-- 
+2.39.5
+
diff --git a/queue-6.1/net-fix-toctou-issue-in-sk_is_readable.patch b/queue-6.1/net-fix-toctou-issue-in-sk_is_readable.patch
new file mode 100644 (file)
index 0000000..4c5d808
--- /dev/null
@@ -0,0 +1,52 @@
+From bc7f96b4010ed4b43fa14b8916acad71617c52cf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Jun 2025 19:08:03 +0200
+Subject: net: Fix TOCTOU issue in sk_is_readable()
+
+From: Michal Luczaj <mhal@rbox.co>
+
+[ Upstream commit 2660a544fdc0940bba15f70508a46cf9a6491230 ]
+
+sk->sk_prot->sock_is_readable is a valid function pointer when sk resides
+in a sockmap. After the last sk_psock_put() (which usually happens when
+socket is removed from sockmap), sk->sk_prot gets restored and
+sk->sk_prot->sock_is_readable becomes NULL.
+
+This makes sk_is_readable() racy, if the value of sk->sk_prot is reloaded
+after the initial check. Which in turn may lead to a null pointer
+dereference.
+
+Ensure the function pointer does not turn NULL after the check.
+
+Fixes: 8934ce2fd081 ("bpf: sockmap redirect ingress support")
+Suggested-by: Jakub Sitnicki <jakub@cloudflare.com>
+Signed-off-by: Michal Luczaj <mhal@rbox.co>
+Reviewed-by: Willem de Bruijn <willemb@google.com>
+Link: https://patch.msgid.link/20250609-skisreadable-toctou-v1-1-d0dfb2d62c37@rbox.co
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/sock.h | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/include/net/sock.h b/include/net/sock.h
+index e716b2ba00bba..e00cd9d0bec8e 100644
+--- a/include/net/sock.h
++++ b/include/net/sock.h
+@@ -3061,8 +3061,11 @@ int sock_copy_user_timeval(struct __kernel_sock_timeval *tv,
+ static inline bool sk_is_readable(struct sock *sk)
+ {
+-      if (sk->sk_prot->sock_is_readable)
+-              return sk->sk_prot->sock_is_readable(sk);
++      const struct proto *prot = READ_ONCE(sk->sk_prot);
++
++      if (prot->sock_is_readable)
++              return prot->sock_is_readable(sk);
++
+       return false;
+ }
+ #endif        /* _SOCK_H */
+-- 
+2.39.5
+
diff --git a/queue-6.1/net-mdio-c22-is-now-optional-eopnotsupp-if-not-provi.patch b/queue-6.1/net-mdio-c22-is-now-optional-eopnotsupp-if-not-provi.patch
new file mode 100644 (file)
index 0000000..ed4901b
--- /dev/null
@@ -0,0 +1,53 @@
+From 761380ccc09d6784828debff21309a5bbf6eeabf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Jan 2023 16:30:44 +0100
+Subject: net: mdio: C22 is now optional, EOPNOTSUPP if not provided
+
+From: Andrew Lunn <andrew@lunn.ch>
+
+[ Upstream commit b063b1924fd9bf0bc157cf644764dc2151d04ccc ]
+
+When performing a C22 operation, check that the bus driver actually
+provides the methods, and return -EOPNOTSUPP if not. C45 only busses
+do exist, and in future their C22 methods will be NULL.
+
+Signed-off-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Michael Walle <michael@walle.cc>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: 0e629694126c ("net/mdiobus: Fix potential out-of-bounds read/write access")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/mdio_bus.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
+index 16e021b477f06..ee5fc73cbe075 100644
+--- a/drivers/net/phy/mdio_bus.c
++++ b/drivers/net/phy/mdio_bus.c
+@@ -764,7 +764,10 @@ int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
+       lockdep_assert_held_once(&bus->mdio_lock);
+-      retval = bus->read(bus, addr, regnum);
++      if (bus->read)
++              retval = bus->read(bus, addr, regnum);
++      else
++              retval = -EOPNOTSUPP;
+       trace_mdio_access(bus, 1, addr, regnum, retval, retval);
+       mdiobus_stats_acct(&bus->stats[addr], true, retval);
+@@ -790,7 +793,10 @@ int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val)
+       lockdep_assert_held_once(&bus->mdio_lock);
+-      err = bus->write(bus, addr, regnum, val);
++      if (bus->write)
++              err = bus->write(bus, addr, regnum, val);
++      else
++              err = -EOPNOTSUPP;
+       trace_mdio_access(bus, 0, addr, regnum, val, err);
+       mdiobus_stats_acct(&bus->stats[addr], false, err);
+-- 
+2.39.5
+
diff --git a/queue-6.1/net-mdiobus-fix-potential-out-of-bounds-read-write-a.patch b/queue-6.1/net-mdiobus-fix-potential-out-of-bounds-read-write-a.patch
new file mode 100644 (file)
index 0000000..365b64e
--- /dev/null
@@ -0,0 +1,58 @@
+From 7bdf868ba3ccc6b36d7a82b65eeaf27559293d23 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Jun 2025 17:31:46 +0200
+Subject: net/mdiobus: Fix potential out-of-bounds read/write access
+
+From: Jakub Raczynski <j.raczynski@samsung.com>
+
+[ Upstream commit 0e629694126ca388916f059453a1c36adde219c4 ]
+
+When using publicly available tools like 'mdio-tools' to read/write data
+from/to network interface and its PHY via mdiobus, there is no verification of
+parameters passed to the ioctl and it accepts any mdio address.
+Currently there is support for 32 addresses in kernel via PHY_MAX_ADDR define,
+but it is possible to pass higher value than that via ioctl.
+While read/write operation should generally fail in this case,
+mdiobus provides stats array, where wrong address may allow out-of-bounds
+read/write.
+
+Fix that by adding address verification before read/write operation.
+While this excludes this access from any statistics, it improves security of
+read/write operation.
+
+Fixes: 080bb352fad00 ("net: phy: Maintain MDIO device and bus statistics")
+Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com>
+Reported-by: Wenjing Shan <wenjing.shan@samsung.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/mdio_bus.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
+index ee5fc73cbe075..7a2dce8d12433 100644
+--- a/drivers/net/phy/mdio_bus.c
++++ b/drivers/net/phy/mdio_bus.c
+@@ -764,6 +764,9 @@ int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
+       lockdep_assert_held_once(&bus->mdio_lock);
++      if (addr >= PHY_MAX_ADDR)
++              return -ENXIO;
++
+       if (bus->read)
+               retval = bus->read(bus, addr, regnum);
+       else
+@@ -793,6 +796,9 @@ int __mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val)
+       lockdep_assert_held_once(&bus->mdio_lock);
++      if (addr >= PHY_MAX_ADDR)
++              return -ENXIO;
++
+       if (bus->write)
+               err = bus->write(bus, addr, regnum, val);
+       else
+-- 
+2.39.5
+
diff --git a/queue-6.1/net-mlx5-ensure-fw-pages-are-always-allocated-on-sam.patch b/queue-6.1/net-mlx5-ensure-fw-pages-are-always-allocated-on-sam.patch
new file mode 100644 (file)
index 0000000..7e82216
--- /dev/null
@@ -0,0 +1,43 @@
+From f04a20c9a2cfd3c5498f18716e107200bbf1bf3b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Jun 2025 18:15:06 +0300
+Subject: net/mlx5: Ensure fw pages are always allocated on same NUMA
+
+From: Moshe Shemesh <moshe@nvidia.com>
+
+[ Upstream commit f37258133c1e95e61db532e14067e28b4881bf24 ]
+
+When firmware asks the driver to allocate more pages, using event of
+give_pages, the driver should always allocate it from same NUMA, the
+original device NUMA. Current code uses dev_to_node() which can result
+in different NUMA as it is changed by other driver flows, such as
+mlx5_dma_zalloc_coherent_node(). Instead, use saved numa node for
+allocating firmware pages.
+
+Fixes: 311c7c71c9bb ("net/mlx5e: Allocate DMA coherent memory on reader NUMA node")
+Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: Mark Bloch <mbloch@nvidia.com>
+Link: https://patch.msgid.link/20250610151514.1094735-2-mbloch@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+index 95dc67fb30015..99909c74a2144 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+@@ -285,7 +285,7 @@ static void free_4k(struct mlx5_core_dev *dev, u64 addr, u32 function)
+ static int alloc_system_page(struct mlx5_core_dev *dev, u32 function)
+ {
+       struct device *device = mlx5_core_dma_dev(dev);
+-      int nid = dev_to_node(device);
++      int nid = dev->priv.numa_node;
+       struct page *page;
+       u64 zero_addr = 1;
+       u64 addr;
+-- 
+2.39.5
+
diff --git a/queue-6.1/net-mlx5-fix-return-value-when-searching-for-existin.patch b/queue-6.1/net-mlx5-fix-return-value-when-searching-for-existin.patch
new file mode 100644 (file)
index 0000000..23594a4
--- /dev/null
@@ -0,0 +1,61 @@
+From 83ce716f59f4ffe82c05d395ad1d94abb155ef2c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Jun 2025 18:15:08 +0300
+Subject: net/mlx5: Fix return value when searching for existing flow group
+
+From: Patrisious Haddad <phaddad@nvidia.com>
+
+[ Upstream commit 8ec40e3f1f72bf8f8accf18020d487caa99f46a4 ]
+
+When attempting to add a rule to an existing flow group, if a matching
+flow group exists but is not active, the error code returned should be
+EAGAIN, so that the rule can be added to the matching flow group once
+it is active, rather than ENOENT, which indicates that no matching
+flow group was found.
+
+Fixes: bd71b08ec2ee ("net/mlx5: Support multiple updates of steering rules in parallel")
+Signed-off-by: Gavi Teitz <gavi@nvidia.com>
+Signed-off-by: Roi Dayan <roid@nvidia.com>
+Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: Mark Bloch <mbloch@nvidia.com>
+Link: https://patch.msgid.link/20250610151514.1094735-4-mbloch@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+index 2717450e96661..b4c0a6dd171fd 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+@@ -1918,6 +1918,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
+       struct mlx5_flow_handle *rule;
+       struct match_list *iter;
+       bool take_write = false;
++      bool try_again = false;
+       struct fs_fte *fte;
+       u64  version = 0;
+       int err;
+@@ -1977,6 +1978,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
+               nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
+               if (!g->node.active) {
++                      try_again = true;
+                       up_write_ref_node(&g->node, false);
+                       continue;
+               }
+@@ -1998,7 +2000,8 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
+                       tree_put_node(&fte->node, false);
+               return rule;
+       }
+-      rule = ERR_PTR(-ENOENT);
++      err = try_again ? -EAGAIN : -ENOENT;
++      rule = ERR_PTR(err);
+ out:
+       kmem_cache_free(steering->ftes_cache, fte);
+       return rule;
+-- 
+2.39.5
+
diff --git a/queue-6.1/net-mlx5e-fix-leak-of-geneve-tlv-option-object.patch b/queue-6.1/net-mlx5e-fix-leak-of-geneve-tlv-option-object.patch
new file mode 100644 (file)
index 0000000..d12be87
--- /dev/null
@@ -0,0 +1,79 @@
+From eb7707f9f8a32d93566d1fc070adc76e4d7df8ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Jun 2025 18:15:13 +0300
+Subject: net/mlx5e: Fix leak of Geneve TLV option object
+
+From: Jianbo Liu <jianbol@nvidia.com>
+
+[ Upstream commit aa9c44b842096c553871bc68a8cebc7861fa192b ]
+
+Previously, a unique tunnel id was added for the matching on TC
+non-zero chains, to support inner header rewrite with goto action.
+Later, it was used to support VF tunnel offload for vxlan, then for
+Geneve and GRE. To support VF tunnel, a temporary mlx5_flow_spec is
+used to parse tunnel options. For Geneve, if there is TLV option, a
+object is created, or refcnt is added if already exists. But the
+temporary mlx5_flow_spec is directly freed after parsing, which causes
+the leak because no information regarding the object is saved in
+flow's mlx5_flow_spec, which is used to free the object when deleting
+the flow.
+
+To fix the leak, call mlx5_geneve_tlv_option_del() before free the
+temporary spec if it has TLV object.
+
+Fixes: 521933cdc4aa ("net/mlx5e: Support Geneve and GRE with VF tunnel offload")
+Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
+Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
+Reviewed-by: Alex Lazar <alazar@nvidia.com>
+Signed-off-by: Mark Bloch <mbloch@nvidia.com>
+Link: https://patch.msgid.link/20250610151514.1094735-9-mbloch@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+index 43239555f7850..05888942ef276 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+@@ -1873,9 +1873,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
+       return err;
+ }
+-static bool mlx5_flow_has_geneve_opt(struct mlx5e_tc_flow *flow)
++static bool mlx5_flow_has_geneve_opt(struct mlx5_flow_spec *spec)
+ {
+-      struct mlx5_flow_spec *spec = &flow->attr->parse_attr->spec;
+       void *headers_v = MLX5_ADDR_OF(fte_match_param,
+                                      spec->match_value,
+                                      misc_parameters_3);
+@@ -1907,7 +1906,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
+       }
+       complete_all(&flow->del_hw_done);
+-      if (mlx5_flow_has_geneve_opt(flow))
++      if (mlx5_flow_has_geneve_opt(&attr->parse_attr->spec))
+               mlx5_geneve_tlv_option_del(priv->mdev->geneve);
+       mlx5_eswitch_del_vlan_action(esw, attr);
+@@ -2415,12 +2414,13 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv,
+               err = mlx5e_tc_tun_parse(filter_dev, priv, tmp_spec, f, match_level);
+               if (err) {
+-                      kvfree(tmp_spec);
+                       NL_SET_ERR_MSG_MOD(extack, "Failed to parse tunnel attributes");
+                       netdev_warn(priv->netdev, "Failed to parse tunnel attributes");
+-                      return err;
++              } else {
++                      err = mlx5e_tc_set_attr_rx_tun(flow, tmp_spec);
+               }
+-              err = mlx5e_tc_set_attr_rx_tun(flow, tmp_spec);
++              if (mlx5_flow_has_geneve_opt(tmp_spec))
++                      mlx5_geneve_tlv_option_del(priv->mdev->geneve);
+               kvfree(tmp_spec);
+               if (err)
+                       return err;
+-- 
+2.39.5
+
diff --git a/queue-6.1/net_sched-ets-fix-a-race-in-ets_qdisc_change.patch b/queue-6.1/net_sched-ets-fix-a-race-in-ets_qdisc_change.patch
new file mode 100644 (file)
index 0000000..c5b4046
--- /dev/null
@@ -0,0 +1,58 @@
+From 71a4c5dce74e85cdc9c3e8692a819cc9f9e9931f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Jun 2025 11:15:14 +0000
+Subject: net_sched: ets: fix a race in ets_qdisc_change()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit d92adacdd8c2960be856e0b82acc5b7c5395fddb ]
+
+Gerrard Tai reported a race condition in ETS, whenever SFQ perturb timer
+fires at the wrong time.
+
+The race is as follows:
+
+CPU 0                                 CPU 1
+[1]: lock root
+[2]: qdisc_tree_flush_backlog()
+[3]: unlock root
+ |
+ |                                    [5]: lock root
+ |                                    [6]: rehash
+ |                                    [7]: qdisc_tree_reduce_backlog()
+ |
+[4]: qdisc_put()
+
+This can be abused to underflow a parent's qlen.
+
+Calling qdisc_purge_queue() instead of qdisc_tree_flush_backlog()
+should fix the race, because all packets will be purged from the qdisc
+before releasing the lock.
+
+Fixes: b05972f01e7d ("net: sched: tbf: don't call qdisc_put() while holding tree lock")
+Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Suggested-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://patch.msgid.link/20250611111515.1983366-5-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_ets.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/sched/sch_ets.c b/net/sched/sch_ets.c
+index 9da86db4d2c2f..3ee46f6e005da 100644
+--- a/net/sched/sch_ets.c
++++ b/net/sched/sch_ets.c
+@@ -661,7 +661,7 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,
+       for (i = q->nbands; i < oldbands; i++) {
+               if (i >= q->nstrict && q->classes[i].qdisc->q.qlen)
+                       list_del_init(&q->classes[i].alist);
+-              qdisc_tree_flush_backlog(q->classes[i].qdisc);
++              qdisc_purge_queue(q->classes[i].qdisc);
+       }
+       q->nstrict = nstrict;
+       memcpy(q->prio2band, priomap, sizeof(priomap));
+-- 
+2.39.5
+
diff --git a/queue-6.1/net_sched-prio-fix-a-race-in-prio_tune.patch b/queue-6.1/net_sched-prio-fix-a-race-in-prio_tune.patch
new file mode 100644 (file)
index 0000000..ddba316
--- /dev/null
@@ -0,0 +1,58 @@
+From 44b42ee94f8af8c39186ca5e2acf0d2a1ba42e5f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Jun 2025 11:15:11 +0000
+Subject: net_sched: prio: fix a race in prio_tune()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit d35acc1be3480505b5931f17e4ea9b7617fea4d3 ]
+
+Gerrard Tai reported a race condition in PRIO, whenever SFQ perturb timer
+fires at the wrong time.
+
+The race is as follows:
+
+CPU 0                                 CPU 1
+[1]: lock root
+[2]: qdisc_tree_flush_backlog()
+[3]: unlock root
+ |
+ |                                    [5]: lock root
+ |                                    [6]: rehash
+ |                                    [7]: qdisc_tree_reduce_backlog()
+ |
+[4]: qdisc_put()
+
+This can be abused to underflow a parent's qlen.
+
+Calling qdisc_purge_queue() instead of qdisc_tree_flush_backlog()
+should fix the race, because all packets will be purged from the qdisc
+before releasing the lock.
+
+Fixes: 7b8e0b6e6599 ("net: sched: prio: delay destroying child qdiscs on change")
+Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Suggested-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://patch.msgid.link/20250611111515.1983366-2-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_prio.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
+index fdc5ef52c3ee9..fdd9caa41e80f 100644
+--- a/net/sched/sch_prio.c
++++ b/net/sched/sch_prio.c
+@@ -211,7 +211,7 @@ static int prio_tune(struct Qdisc *sch, struct nlattr *opt,
+       memcpy(q->prio2band, qopt->priomap, TC_PRIO_MAX+1);
+       for (i = q->bands; i < oldbands; i++)
+-              qdisc_tree_flush_backlog(q->queues[i]);
++              qdisc_purge_queue(q->queues[i]);
+       for (i = oldbands; i < q->bands; i++) {
+               q->queues[i] = queues[i];
+-- 
+2.39.5
+
diff --git a/queue-6.1/net_sched-red-fix-a-race-in-__red_change.patch b/queue-6.1/net_sched-red-fix-a-race-in-__red_change.patch
new file mode 100644 (file)
index 0000000..b758553
--- /dev/null
@@ -0,0 +1,58 @@
+From 57959c5a2dc02405c0117d22030c85b3af0d0199 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Jun 2025 11:15:12 +0000
+Subject: net_sched: red: fix a race in __red_change()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 85a3e0ede38450ea3053b8c45d28cf55208409b8 ]
+
+Gerrard Tai reported a race condition in RED, whenever SFQ perturb timer
+fires at the wrong time.
+
+The race is as follows:
+
+CPU 0                                 CPU 1
+[1]: lock root
+[2]: qdisc_tree_flush_backlog()
+[3]: unlock root
+ |
+ |                                    [5]: lock root
+ |                                    [6]: rehash
+ |                                    [7]: qdisc_tree_reduce_backlog()
+ |
+[4]: qdisc_put()
+
+This can be abused to underflow a parent's qlen.
+
+Calling qdisc_purge_queue() instead of qdisc_tree_flush_backlog()
+should fix the race, because all packets will be purged from the qdisc
+before releasing the lock.
+
+Fixes: 0c8d13ac9607 ("net: sched: red: delay destroying child qdisc on replace")
+Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Suggested-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://patch.msgid.link/20250611111515.1983366-3-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_red.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
+index 16277b6a0238d..3c6b4460cf2c0 100644
+--- a/net/sched/sch_red.c
++++ b/net/sched/sch_red.c
+@@ -283,7 +283,7 @@ static int __red_change(struct Qdisc *sch, struct nlattr **tb,
+       q->userbits = userbits;
+       q->limit = ctl->limit;
+       if (child) {
+-              qdisc_tree_flush_backlog(q->qdisc);
++              qdisc_purge_queue(q->qdisc);
+               old_child = q->qdisc;
+               q->qdisc = child;
+       }
+-- 
+2.39.5
+
diff --git a/queue-6.1/net_sched-sch_sfq-fix-a-potential-crash-on-gso_skb-h.patch b/queue-6.1/net_sched-sch_sfq-fix-a-potential-crash-on-gso_skb-h.patch
new file mode 100644 (file)
index 0000000..99f0ef7
--- /dev/null
@@ -0,0 +1,70 @@
+From 737a4e8052d6e0fc13c51b7d8f5f1d4febaa01ab Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Jun 2025 16:51:27 +0000
+Subject: net_sched: sch_sfq: fix a potential crash on gso_skb handling
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 82ffbe7776d0ac084031f114167712269bf3d832 ]
+
+SFQ has an assumption of always being able to queue at least one packet.
+
+However, after the blamed commit, sch->q.len can be inflated by packets
+in sch->gso_skb, and an enqueue() on an empty SFQ qdisc can be followed
+by an immediate drop.
+
+Fix sfq_drop() to properly clear q->tail in this situation.
+
+Tested:
+
+ip netns add lb
+ip link add dev to-lb type veth peer name in-lb netns lb
+ethtool -K to-lb tso off                 # force qdisc to requeue gso_skb
+ip netns exec lb ethtool -K in-lb gro on # enable NAPI
+ip link set dev to-lb up
+ip -netns lb link set dev in-lb up
+ip addr add dev to-lb 192.168.20.1/24
+ip -netns lb addr add dev in-lb 192.168.20.2/24
+tc qdisc replace dev to-lb root sfq limit 100
+
+ip netns exec lb netserver
+
+netperf -H 192.168.20.2 -l 100 &
+netperf -H 192.168.20.2 -l 100 &
+netperf -H 192.168.20.2 -l 100 &
+netperf -H 192.168.20.2 -l 100 &
+
+Fixes: a53851e2c321 ("net: sched: explicit locking in gso_cpu fallback")
+Reported-by: Marcus Wichelmann <marcus.wichelmann@hetzner-cloud.de>
+Closes: https://lore.kernel.org/netdev/9da42688-bfaa-4364-8797-e9271f3bdaef@hetzner-cloud.de/
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
+Link: https://patch.msgid.link/20250606165127.3629486-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_sfq.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
+index 002941d35b643..d564675a8be4d 100644
+--- a/net/sched/sch_sfq.c
++++ b/net/sched/sch_sfq.c
+@@ -310,7 +310,10 @@ static unsigned int sfq_drop(struct Qdisc *sch, struct sk_buff **to_free)
+               /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */
+               x = q->tail->next;
+               slot = &q->slots[x];
+-              q->tail->next = slot->next;
++              if (slot->next == x)
++                      q->tail = NULL; /* no more active slots */
++              else
++                      q->tail->next = slot->next;
+               q->ht[slot->hash] = SFQ_EMPTY_SLOT;
+               goto drop;
+       }
+-- 
+2.39.5
+
diff --git a/queue-6.1/net_sched-tbf-fix-a-race-in-tbf_change.patch b/queue-6.1/net_sched-tbf-fix-a-race-in-tbf_change.patch
new file mode 100644 (file)
index 0000000..d62e5a1
--- /dev/null
@@ -0,0 +1,59 @@
+From 303598be96b6910901d33e191c5cd5df520e7ce3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Jun 2025 11:15:13 +0000
+Subject: net_sched: tbf: fix a race in tbf_change()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 43eb466041216d25dedaef1c383ad7bd89929cbc ]
+
+Gerrard Tai reported a race condition in TBF, whenever SFQ perturb timer
+fires at the wrong time.
+
+The race is as follows:
+
+CPU 0                                 CPU 1
+[1]: lock root
+[2]: qdisc_tree_flush_backlog()
+[3]: unlock root
+ |
+ |                                    [5]: lock root
+ |                                    [6]: rehash
+ |                                    [7]: qdisc_tree_reduce_backlog()
+ |
+[4]: qdisc_put()
+
+This can be abused to underflow a parent's qlen.
+
+Calling qdisc_purge_queue() instead of qdisc_tree_flush_backlog()
+should fix the race, because all packets will be purged from the qdisc
+before releasing the lock.
+
+Fixes: b05972f01e7d ("net: sched: tbf: don't call qdisc_put() while holding tree lock")
+Reported-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Suggested-by: Gerrard Tai <gerrard.tai@starlabs.sg>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Cc: Zhengchao Shao <shaozhengchao@huawei.com>
+Link: https://patch.msgid.link/20250611111515.1983366-4-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sched/sch_tbf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
+index c4c91b55e98b0..ebf67b8a6ee79 100644
+--- a/net/sched/sch_tbf.c
++++ b/net/sched/sch_tbf.c
+@@ -451,7 +451,7 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt,
+       sch_tree_lock(sch);
+       if (child) {
+-              qdisc_tree_flush_backlog(q->qdisc);
++              qdisc_purge_queue(q->qdisc);
+               old = q->qdisc;
+               q->qdisc = child;
+       }
+-- 
+2.39.5
+
diff --git a/queue-6.1/pinctrl-qcom-pinctrl-qcm2290-add-missing-pins.patch b/queue-6.1/pinctrl-qcom-pinctrl-qcm2290-add-missing-pins.patch
new file mode 100644 (file)
index 0000000..ac92e69
--- /dev/null
@@ -0,0 +1,57 @@
+From 7a0f343f323d7dc2ac9c50600d5836057b8f07fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 May 2025 12:14:37 +0200
+Subject: pinctrl: qcom: pinctrl-qcm2290: Add missing pins
+
+From: Wojciech Slenska <wojciech.slenska@gmail.com>
+
+[ Upstream commit 315345610faee8a0568b522dba9e35067d1732ab ]
+
+Added the missing pins to the qcm2290_pins table.
+
+Signed-off-by: Wojciech Slenska <wojciech.slenska@gmail.com>
+Fixes: 48e049ef1238 ("pinctrl: qcom: Add QCM2290 pinctrl driver")
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
+Link: https://lore.kernel.org/20250523101437.59092-1-wojciech.slenska@gmail.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pinctrl/qcom/pinctrl-qcm2290.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/drivers/pinctrl/qcom/pinctrl-qcm2290.c b/drivers/pinctrl/qcom/pinctrl-qcm2290.c
+index aa9325f333fba..fa4575a9396ae 100644
+--- a/drivers/pinctrl/qcom/pinctrl-qcm2290.c
++++ b/drivers/pinctrl/qcom/pinctrl-qcm2290.c
+@@ -173,6 +173,10 @@ static const struct pinctrl_pin_desc qcm2290_pins[] = {
+       PINCTRL_PIN(62, "GPIO_62"),
+       PINCTRL_PIN(63, "GPIO_63"),
+       PINCTRL_PIN(64, "GPIO_64"),
++      PINCTRL_PIN(65, "GPIO_65"),
++      PINCTRL_PIN(66, "GPIO_66"),
++      PINCTRL_PIN(67, "GPIO_67"),
++      PINCTRL_PIN(68, "GPIO_68"),
+       PINCTRL_PIN(69, "GPIO_69"),
+       PINCTRL_PIN(70, "GPIO_70"),
+       PINCTRL_PIN(71, "GPIO_71"),
+@@ -187,12 +191,17 @@ static const struct pinctrl_pin_desc qcm2290_pins[] = {
+       PINCTRL_PIN(80, "GPIO_80"),
+       PINCTRL_PIN(81, "GPIO_81"),
+       PINCTRL_PIN(82, "GPIO_82"),
++      PINCTRL_PIN(83, "GPIO_83"),
++      PINCTRL_PIN(84, "GPIO_84"),
++      PINCTRL_PIN(85, "GPIO_85"),
+       PINCTRL_PIN(86, "GPIO_86"),
+       PINCTRL_PIN(87, "GPIO_87"),
+       PINCTRL_PIN(88, "GPIO_88"),
+       PINCTRL_PIN(89, "GPIO_89"),
+       PINCTRL_PIN(90, "GPIO_90"),
+       PINCTRL_PIN(91, "GPIO_91"),
++      PINCTRL_PIN(92, "GPIO_92"),
++      PINCTRL_PIN(93, "GPIO_93"),
+       PINCTRL_PIN(94, "GPIO_94"),
+       PINCTRL_PIN(95, "GPIO_95"),
+       PINCTRL_PIN(96, "GPIO_96"),
+-- 
+2.39.5
+
diff --git a/queue-6.1/powerpc-powernv-memtrace-fix-out-of-bounds-issue-in-.patch b/queue-6.1/powerpc-powernv-memtrace-fix-out-of-bounds-issue-in-.patch
new file mode 100644 (file)
index 0000000..66d9bbb
--- /dev/null
@@ -0,0 +1,48 @@
+From 4c96c6abccfef32c36f70af901f7850e98c93e69 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Jun 2025 07:42:26 +0530
+Subject: powerpc/powernv/memtrace: Fix out of bounds issue in memtrace mmap
+
+From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
+
+[ Upstream commit cd097df4596f3a1e9d75eb8520162de1eb8485b2 ]
+
+memtrace mmap issue has an out of bounds issue. This patch fixes the by
+checking that the requested mapping region size should stay within the
+allocated region size.
+
+Reported-by: Jonathan Greental <yonatan02greental@gmail.com>
+Fixes: 08a022ad3dfa ("powerpc/powernv/memtrace: Allow mmaping trace buffers")
+Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
+Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
+Link: https://patch.msgid.link/20250610021227.361980-1-maddy@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/powernv/memtrace.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
+index 877720c645151..35471b679638a 100644
+--- a/arch/powerpc/platforms/powernv/memtrace.c
++++ b/arch/powerpc/platforms/powernv/memtrace.c
+@@ -48,11 +48,15 @@ static ssize_t memtrace_read(struct file *filp, char __user *ubuf,
+ static int memtrace_mmap(struct file *filp, struct vm_area_struct *vma)
+ {
+       struct memtrace_entry *ent = filp->private_data;
++      unsigned long ent_nrpages = ent->size >> PAGE_SHIFT;
++      unsigned long vma_nrpages = vma_pages(vma);
+-      if (ent->size < vma->vm_end - vma->vm_start)
++      /* The requested page offset should be within object's page count */
++      if (vma->vm_pgoff >= ent_nrpages)
+               return -EINVAL;
+-      if (vma->vm_pgoff << PAGE_SHIFT >= ent->size)
++      /* The requested mapping range should remain within the bounds */
++      if (vma_nrpages > ent_nrpages - vma->vm_pgoff)
+               return -EINVAL;
+       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+-- 
+2.39.5
+
diff --git a/queue-6.1/powerpc-vas-return-einval-if-the-offset-is-non-zero-.patch b/queue-6.1/powerpc-vas-return-einval-if-the-offset-is-non-zero-.patch
new file mode 100644 (file)
index 0000000..8b9b60f
--- /dev/null
@@ -0,0 +1,52 @@
+From 0ffbbcf4986582634938c64a1277f39bbce22c12 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Jun 2025 07:42:27 +0530
+Subject: powerpc/vas: Return -EINVAL if the offset is non-zero in mmap()
+
+From: Haren Myneni <haren@linux.ibm.com>
+
+[ Upstream commit 0d67f0dee6c9176bc09a5482dd7346e3a0f14d0b ]
+
+The user space calls mmap() to map VAS window paste address
+and the kernel returns the complete mapped page for each
+window. So return -EINVAL if non-zero is passed for offset
+parameter to mmap().
+
+See Documentation/arch/powerpc/vas-api.rst for mmap()
+restrictions.
+
+Co-developed-by: Jonathan Greental <yonatan02greental@gmail.com>
+Signed-off-by: Jonathan Greental <yonatan02greental@gmail.com>
+Reported-by: Jonathan Greental <yonatan02greental@gmail.com>
+Fixes: dda44eb29c23 ("powerpc/vas: Add VAS user space API")
+Signed-off-by: Haren Myneni <haren@linux.ibm.com>
+Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
+Link: https://patch.msgid.link/20250610021227.361980-2-maddy@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/book3s/vas-api.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c
+index d954ddf7f0592..0f73554c6ae90 100644
+--- a/arch/powerpc/platforms/book3s/vas-api.c
++++ b/arch/powerpc/platforms/book3s/vas-api.c
+@@ -521,6 +521,15 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
+               return -EINVAL;
+       }
++      /*
++       * Map complete page to the paste address. So the user
++       * space should pass 0ULL to the offset parameter.
++       */
++      if (vma->vm_pgoff) {
++              pr_debug("Page offset unsupported to map paste address\n");
++              return -EINVAL;
++      }
++
+       /* Ensure instance has an open send window */
+       if (!txwin) {
+               pr_err("No send window open?\n");
+-- 
+2.39.5
+
diff --git a/queue-6.1/ptp-remove-ptp-n_vclocks-check-logic-in-ptp_vclock_i.patch b/queue-6.1/ptp-remove-ptp-n_vclocks-check-logic-in-ptp_vclock_i.patch
new file mode 100644 (file)
index 0000000..e84107b
--- /dev/null
@@ -0,0 +1,90 @@
+From 6663ec7977bf2187718529093c03884e81db2a93 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 May 2025 01:07:17 +0900
+Subject: ptp: remove ptp->n_vclocks check logic in ptp_vclock_in_use()
+
+From: Jeongjun Park <aha310510@gmail.com>
+
+[ Upstream commit 87f7ce260a3c838b49e1dc1ceedf1006795157a2 ]
+
+There is no disagreement that we should check both ptp->is_virtual_clock
+and ptp->n_vclocks to check if the ptp virtual clock is in use.
+
+However, when we acquire ptp->n_vclocks_mux to read ptp->n_vclocks in
+ptp_vclock_in_use(), we observe a recursive lock in the call trace
+starting from n_vclocks_store().
+
+============================================
+WARNING: possible recursive locking detected
+6.15.0-rc6 #1 Not tainted
+--------------------------------------------
+syz.0.1540/13807 is trying to acquire lock:
+ffff888035a24868 (&ptp->n_vclocks_mux){+.+.}-{4:4}, at:
+ ptp_vclock_in_use drivers/ptp/ptp_private.h:103 [inline]
+ffff888035a24868 (&ptp->n_vclocks_mux){+.+.}-{4:4}, at:
+ ptp_clock_unregister+0x21/0x250 drivers/ptp/ptp_clock.c:415
+
+but task is already holding lock:
+ffff888030704868 (&ptp->n_vclocks_mux){+.+.}-{4:4}, at:
+ n_vclocks_store+0xf1/0x6d0 drivers/ptp/ptp_sysfs.c:215
+
+other info that might help us debug this:
+ Possible unsafe locking scenario:
+
+       CPU0
+       ----
+  lock(&ptp->n_vclocks_mux);
+  lock(&ptp->n_vclocks_mux);
+
+ *** DEADLOCK ***
+....
+============================================
+
+The best way to solve this is to remove the logic that checks
+ptp->n_vclocks in ptp_vclock_in_use().
+
+The reason why this is appropriate is that any path that uses
+ptp->n_vclocks must unconditionally check if ptp->n_vclocks is greater
+than 0 before unregistering vclocks, and all functions are already
+written this way. And in the function that uses ptp->n_vclocks, we
+already get ptp->n_vclocks_mux before unregistering vclocks.
+
+Therefore, we need to remove the redundant check for ptp->n_vclocks in
+ptp_vclock_in_use() to prevent recursive locking.
+
+Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
+Signed-off-by: Jeongjun Park <aha310510@gmail.com>
+Acked-by: Richard Cochran <richardcochran@gmail.com>
+Link: https://patch.msgid.link/20250520160717.7350-1-aha310510@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ptp/ptp_private.h | 12 +-----------
+ 1 file changed, 1 insertion(+), 11 deletions(-)
+
+diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h
+index b8d4f61f14be4..d0eb4555720eb 100644
+--- a/drivers/ptp/ptp_private.h
++++ b/drivers/ptp/ptp_private.h
+@@ -89,17 +89,7 @@ static inline int queue_cnt(const struct timestamp_event_queue *q)
+ /* Check if ptp virtual clock is in use */
+ static inline bool ptp_vclock_in_use(struct ptp_clock *ptp)
+ {
+-      bool in_use = false;
+-
+-      if (mutex_lock_interruptible(&ptp->n_vclocks_mux))
+-              return true;
+-
+-      if (!ptp->is_virtual_clock && ptp->n_vclocks)
+-              in_use = true;
+-
+-      mutex_unlock(&ptp->n_vclocks_mux);
+-
+-      return in_use;
++      return !ptp->is_virtual_clock;
+ }
+ /* Check if ptp clock shall be free running */
+-- 
+2.39.5
+
diff --git a/queue-6.1/regulator-max20086-fix-refcount-leak-in-max20086_par.patch b/queue-6.1/regulator-max20086-fix-refcount-leak-in-max20086_par.patch
new file mode 100644 (file)
index 0000000..4b6ed2b
--- /dev/null
@@ -0,0 +1,61 @@
+From 4f800188768509e29fceff1d4ea8694a2fe2f537 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 May 2025 08:44:14 +0300
+Subject: regulator: max20086: Fix refcount leak in
+ max20086_parse_regulators_dt()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit 06118ae36855b7d3d22688298e74a766ccf0cb7a ]
+
+There is a missing call to of_node_put() if devm_kcalloc() fails.
+Fix this by changing the code to use cleanup.h magic to drop the
+refcount.
+
+Fixes: 6b0cd72757c6 ("regulator: max20086: fix invalid memory access")
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Link: https://patch.msgid.link/aDVRLqgJWMxYU03G@stanley.mountain
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/max20086-regulator.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c
+index 332fb58f90952..a24dfffce25c7 100644
+--- a/drivers/regulator/max20086-regulator.c
++++ b/drivers/regulator/max20086-regulator.c
+@@ -5,6 +5,7 @@
+ // Copyright (C) 2022 Laurent Pinchart <laurent.pinchart@idesonboard.com>
+ // Copyright (C) 2018 Avnet, Inc.
++#include <linux/cleanup.h>
+ #include <linux/err.h>
+ #include <linux/gpio.h>
+ #include <linux/gpio/consumer.h>
+@@ -134,11 +135,11 @@ static int max20086_regulators_register(struct max20086 *chip)
+ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)
+ {
+       struct of_regulator_match *matches;
+-      struct device_node *node;
+       unsigned int i;
+       int ret;
+-      node = of_get_child_by_name(chip->dev->of_node, "regulators");
++      struct device_node *node __free(device_node) =
++              of_get_child_by_name(chip->dev->of_node, "regulators");
+       if (!node) {
+               dev_err(chip->dev, "regulators node not found\n");
+               return -ENODEV;
+@@ -154,7 +155,6 @@ static int max20086_parse_regulators_dt(struct max20086 *chip, bool *boot_on)
+       ret = of_regulator_match(chip->dev, node, matches,
+                                chip->info->num_outputs);
+-      of_node_put(node);
+       if (ret < 0) {
+               dev_err(chip->dev, "Failed to match regulators\n");
+               return -EINVAL;
+-- 
+2.39.5
+
diff --git a/queue-6.1/scsi-core-ufs-fix-a-hang-in-the-error-handler.patch b/queue-6.1/scsi-core-ufs-fix-a-hang-in-the-error-handler.patch
new file mode 100644 (file)
index 0000000..50f3d40
--- /dev/null
@@ -0,0 +1,73 @@
+From 9eac05e53a689786a8583d19aee876cd48254fdb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 May 2025 13:14:01 -0700
+Subject: scsi: core: ufs: Fix a hang in the error handler
+
+From: Sanjeev Yadav <sanjeev.y@mediatek.com>
+
+[ Upstream commit 8a3514d348de87a9d5e2ac00fbac4faae0b97996 ]
+
+ufshcd_err_handling_prepare() calls ufshcd_rpm_get_sync(). The latter
+function can only succeed if UFSHCD_EH_IN_PROGRESS is not set because
+resuming involves submitting a SCSI command and ufshcd_queuecommand()
+returns SCSI_MLQUEUE_HOST_BUSY if UFSHCD_EH_IN_PROGRESS is set. Fix this
+hang by setting UFSHCD_EH_IN_PROGRESS after ufshcd_rpm_get_sync() has
+been called instead of before.
+
+Backtrace:
+__switch_to+0x174/0x338
+__schedule+0x600/0x9e4
+schedule+0x7c/0xe8
+schedule_timeout+0xa4/0x1c8
+io_schedule_timeout+0x48/0x70
+wait_for_common_io+0xa8/0x160 //waiting on START_STOP
+wait_for_completion_io_timeout+0x10/0x20
+blk_execute_rq+0xe4/0x1e4
+scsi_execute_cmd+0x108/0x244
+ufshcd_set_dev_pwr_mode+0xe8/0x250
+__ufshcd_wl_resume+0x94/0x354
+ufshcd_wl_runtime_resume+0x3c/0x174
+scsi_runtime_resume+0x64/0xa4
+rpm_resume+0x15c/0xa1c
+__pm_runtime_resume+0x4c/0x90 // Runtime resume ongoing
+ufshcd_err_handler+0x1a0/0xd08
+process_one_work+0x174/0x808
+worker_thread+0x15c/0x490
+kthread+0xf4/0x1ec
+ret_from_fork+0x10/0x20
+
+Signed-off-by: Sanjeev Yadav <sanjeev.y@mediatek.com>
+[ bvanassche: rewrote patch description ]
+Fixes: 62694735ca95 ("[SCSI] ufs: Add runtime PM support for UFS host controller driver")
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+Link: https://lore.kernel.org/r/20250523201409.1676055-1-bvanassche@acm.org
+Reviewed-by: Peter Wang <peter.wang@mediatek.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ufs/core/ufshcd.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
+index c5115f6adbdc2..dc17ae1dfe260 100644
+--- a/drivers/ufs/core/ufshcd.c
++++ b/drivers/ufs/core/ufshcd.c
+@@ -6285,9 +6285,14 @@ static void ufshcd_err_handler(struct work_struct *work)
+               up(&hba->host_sem);
+               return;
+       }
+-      ufshcd_set_eh_in_progress(hba);
+       spin_unlock_irqrestore(hba->host->host_lock, flags);
++
+       ufshcd_err_handling_prepare(hba);
++
++      spin_lock_irqsave(hba->host->host_lock, flags);
++      ufshcd_set_eh_in_progress(hba);
++      spin_unlock_irqrestore(hba->host->host_lock, flags);
++
+       /* Complete requests that have door-bell cleared by h/w */
+       ufshcd_complete_requests(hba);
+       spin_lock_irqsave(hba->host->host_lock, flags);
+-- 
+2.39.5
+
diff --git a/queue-6.1/scsi-iscsi-fix-incorrect-error-path-labels-for-flash.patch b/queue-6.1/scsi-iscsi-fix-incorrect-error-path-labels-for-flash.patch
new file mode 100644 (file)
index 0000000..aee9a27
--- /dev/null
@@ -0,0 +1,99 @@
+From f63aeaad647d7c88a8c28cd84eb35983e6a86cad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 May 2025 12:29:35 -0700
+Subject: scsi: iscsi: Fix incorrect error path labels for flashnode operations
+
+From: Alok Tiwari <alok.a.tiwari@oracle.com>
+
+[ Upstream commit 9b17621366d210ffee83262a8754086ebbde5e55 ]
+
+Correct the error handling goto labels used when host lookup fails in
+various flashnode-related event handlers:
+
+ - iscsi_new_flashnode()
+ - iscsi_del_flashnode()
+ - iscsi_login_flashnode()
+ - iscsi_logout_flashnode()
+ - iscsi_logout_flashnode_sid()
+
+scsi_host_put() is not required when shost is NULL, so jumping to the
+correct label avoids unnecessary operations. These functions previously
+jumped to the wrong goto label (put_host), which did not match the
+intended cleanup logic.
+
+Use the correct exit labels (exit_new_fnode, exit_del_fnode, etc.) to
+ensure proper error handling.  Also remove the unused put_host label
+under iscsi_new_flashnode() as it is no longer needed.
+
+No functional changes beyond accurate error path correction.
+
+Fixes: c6a4bb2ef596 ("[SCSI] scsi_transport_iscsi: Add flash node mgmt support")
+Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
+Link: https://lore.kernel.org/r/20250530193012.3312911-1-alok.a.tiwari@oracle.com
+Reviewed-by: Mike Christie <michael.christie@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/scsi_transport_iscsi.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
+index 7f0fd03dd03bc..c44103752b699 100644
+--- a/drivers/scsi/scsi_transport_iscsi.c
++++ b/drivers/scsi/scsi_transport_iscsi.c
+@@ -3524,7 +3524,7 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
+               pr_err("%s could not find host no %u\n",
+                      __func__, ev->u.new_flashnode.host_no);
+               err = -ENODEV;
+-              goto put_host;
++              goto exit_new_fnode;
+       }
+       index = transport->new_flashnode(shost, data, len);
+@@ -3534,7 +3534,6 @@ static int iscsi_new_flashnode(struct iscsi_transport *transport,
+       else
+               err = -EIO;
+-put_host:
+       scsi_host_put(shost);
+ exit_new_fnode:
+@@ -3559,7 +3558,7 @@ static int iscsi_del_flashnode(struct iscsi_transport *transport,
+               pr_err("%s could not find host no %u\n",
+                      __func__, ev->u.del_flashnode.host_no);
+               err = -ENODEV;
+-              goto put_host;
++              goto exit_del_fnode;
+       }
+       idx = ev->u.del_flashnode.flashnode_idx;
+@@ -3601,7 +3600,7 @@ static int iscsi_login_flashnode(struct iscsi_transport *transport,
+               pr_err("%s could not find host no %u\n",
+                      __func__, ev->u.login_flashnode.host_no);
+               err = -ENODEV;
+-              goto put_host;
++              goto exit_login_fnode;
+       }
+       idx = ev->u.login_flashnode.flashnode_idx;
+@@ -3653,7 +3652,7 @@ static int iscsi_logout_flashnode(struct iscsi_transport *transport,
+               pr_err("%s could not find host no %u\n",
+                      __func__, ev->u.logout_flashnode.host_no);
+               err = -ENODEV;
+-              goto put_host;
++              goto exit_logout_fnode;
+       }
+       idx = ev->u.logout_flashnode.flashnode_idx;
+@@ -3703,7 +3702,7 @@ static int iscsi_logout_flashnode_sid(struct iscsi_transport *transport,
+               pr_err("%s could not find host no %u\n",
+                      __func__, ev->u.logout_flashnode.host_no);
+               err = -ENODEV;
+-              goto put_host;
++              goto exit_logout_sid;
+       }
+       session = iscsi_session_lookup(ev->u.logout_flashnode_sid.sid);
+-- 
+2.39.5
+
index 97d176a02ca37ec956a2dcb7032b5675c0e83e5b..9013c611d38b16a8c9e67f4a3b86185bbf01ffa8 100644 (file)
@@ -230,3 +230,42 @@ serial-sh-sci-check-if-tx-data-was-written-to-device.patch
 serial-sh-sci-move-runtime-pm-enable-to-sci_probe_si.patch
 serial-sh-sci-clean-sci_ports-0-after-at-earlycon-ex.patch
 serial-sh-sci-increment-the-runtime-usage-counter-fo.patch
+scsi-core-ufs-fix-a-hang-in-the-error-handler.patch
+bluetooth-hci_core-fix-list_for_each_entry_rcu-usage.patch
+bluetooth-mgmt-fix-uaf-on-mgmt_remove_adv_monitor_co.patch
+ptp-remove-ptp-n_vclocks-check-logic-in-ptp_vclock_i.patch
+ath10k-snoc-fix-unbalanced-irq-enable-in-crash-recov.patch
+wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch
+wifi-ath11k-fix-soc_dp_stats-debugfs-file-permission.patch
+wifi-ath11k-convert-timeouts-to-secs_to_jiffies.patch
+wifi-ath11k-avoid-burning-cpu-in-ath11k_debugfs_fw_s.patch
+wifi-ath11k-don-t-use-static-variables-in-ath11k_deb.patch
+wifi-ath11k-don-t-wait-when-there-is-no-vdev-started.patch
+wifi-ath11k-validate-ath11k_crypto_mode-on-top-of-at.patch
+regulator-max20086-fix-refcount-leak-in-max20086_par.patch
+pinctrl-qcom-pinctrl-qcm2290-add-missing-pins.patch
+scsi-iscsi-fix-incorrect-error-path-labels-for-flash.patch
+net_sched-sch_sfq-fix-a-potential-crash-on-gso_skb-h.patch
+powerpc-powernv-memtrace-fix-out-of-bounds-issue-in-.patch
+powerpc-vas-return-einval-if-the-offset-is-non-zero-.patch
+drm-meson-use-unsigned-long-long-hz-for-frequency-ty.patch
+drm-meson-fix-debug-log-statement-when-setting-the-h.patch
+drm-meson-use-vclk_freq-instead-of-pixel_freq-in-deb.patch
+drm-meson-fix-more-rounding-issues-with-59.94hz-mode.patch
+i40e-return-false-from-i40e_reset_vf-if-reset-is-in-.patch
+i40e-retry-vflr-handling-if-there-is-ongoing-vf-rese.patch
+acpi-cppc-fix-null-pointer-dereference-when-nosmp-is.patch
+net-fix-toctou-issue-in-sk_is_readable.patch
+macsec-macsec-sci-assignment-for-es-0.patch
+net-mdio-c22-is-now-optional-eopnotsupp-if-not-provi.patch
+net-mdiobus-fix-potential-out-of-bounds-read-write-a.patch
+bluetooth-fix-null-pointer-deference-on-eir_get_serv.patch
+bluetooth-hci_sync-fix-broadcast-pa-when-using-an-ex.patch
+bluetooth-mgmt-fix-sparse-errors.patch
+net-mlx5-ensure-fw-pages-are-always-allocated-on-sam.patch
+net-mlx5-fix-return-value-when-searching-for-existin.patch
+net-mlx5e-fix-leak-of-geneve-tlv-option-object.patch
+net_sched-prio-fix-a-race-in-prio_tune.patch
+net_sched-red-fix-a-race-in-__red_change.patch
+net_sched-tbf-fix-a-race-in-tbf_change.patch
+net_sched-ets-fix-a-race-in-ets_qdisc_change.patch
diff --git a/queue-6.1/wifi-ath11k-avoid-burning-cpu-in-ath11k_debugfs_fw_s.patch b/queue-6.1/wifi-ath11k-avoid-burning-cpu-in-ath11k_debugfs_fw_s.patch
new file mode 100644 (file)
index 0000000..29be9ea
--- /dev/null
@@ -0,0 +1,231 @@
+From e498e22822cc4331241049a0051c0bae0101b2b0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Feb 2025 16:24:42 +0800
+Subject: wifi: ath11k: avoid burning CPU in ath11k_debugfs_fw_stats_request()
+
+From: Baochen Qiang <quic_bqiang@quicinc.com>
+
+[ Upstream commit 9f6e82d11bb9692a90d20b10f87345598945c803 ]
+
+We get report [1] that CPU is running a hot loop in
+ath11k_debugfs_fw_stats_request():
+
+94.60%     0.00%  i3status         [kernel.kallsyms]                 [k] do_syscall_64
+        |
+         --94.60%--do_syscall_64
+                   |
+                    --94.55%--__sys_sendmsg
+                              ___sys_sendmsg
+                              ____sys_sendmsg
+                              netlink_sendmsg
+                              netlink_unicast
+                              genl_rcv
+                              netlink_rcv_skb
+                              genl_rcv_msg
+                              |
+                               --94.55%--genl_family_rcv_msg_dumpit
+                                         __netlink_dump_start
+                                         netlink_dump
+                                         genl_dumpit
+                                         nl80211_dump_station
+                                         |
+                                          --94.55%--ieee80211_dump_station
+                                                    sta_set_sinfo
+                                                    |
+                                                     --94.55%--ath11k_mac_op_sta_statistics
+                                                               ath11k_debugfs_get_fw_stats
+                                                               |
+                                                                --94.55%--ath11k_debugfs_fw_stats_request
+                                                                          |
+                                                                          |--41.73%--_raw_spin_lock_bh
+                                                                          |
+                                                                          |--22.74%--__local_bh_enable_ip
+                                                                          |
+                                                                          |--9.22%--_raw_spin_unlock_bh
+                                                                          |
+                                                                           --6.66%--srso_alias_safe_ret
+
+This is because, if for whatever reason ar->fw_stats_done is not set by
+ath11k_update_stats_event(), ath11k_debugfs_fw_stats_request() won't yield
+CPU before an up to 3s timeout.
+
+Change to completion mechanism to avoid CPU burning.
+
+Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.37
+
+Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
+Reported-by: Yury Vostrikov <mon@unformed.ru>
+Closes: https://lore.kernel.org/all/7324ac7a-8b7a-42a5-aa19-de52138ff638@app.fastmail.com/ # [1]
+Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
+Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
+Link: https://patch.msgid.link/20250220082448.31039-2-quic_bqiang@quicinc.com
+Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/core.c    |  1 +
+ drivers/net/wireless/ath/ath11k/core.h    |  2 +-
+ drivers/net/wireless/ath/ath11k/debugfs.c | 38 +++++++++--------------
+ drivers/net/wireless/ath/ath11k/mac.c     |  2 +-
+ drivers/net/wireless/ath/ath11k/wmi.c     |  2 +-
+ 5 files changed, 18 insertions(+), 27 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
+index ef269244fe495..a8bdddccca4cb 100644
+--- a/drivers/net/wireless/ath/ath11k/core.c
++++ b/drivers/net/wireless/ath/ath11k/core.c
+@@ -644,6 +644,7 @@ void ath11k_fw_stats_init(struct ath11k *ar)
+       INIT_LIST_HEAD(&ar->fw_stats.bcn);
+       init_completion(&ar->fw_stats_complete);
++      init_completion(&ar->fw_stats_done);
+ }
+ void ath11k_fw_stats_free(struct ath11k_fw_stats *stats)
+diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
+index bd06536f82a64..69feef410b359 100644
+--- a/drivers/net/wireless/ath/ath11k/core.h
++++ b/drivers/net/wireless/ath/ath11k/core.h
+@@ -718,7 +718,7 @@ struct ath11k {
+       u8 alpha2[REG_ALPHA2_LEN + 1];
+       struct ath11k_fw_stats fw_stats;
+       struct completion fw_stats_complete;
+-      bool fw_stats_done;
++      struct completion fw_stats_done;
+       /* protected by conf_mutex */
+       bool ps_state_enable;
+diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
+index a8bd944f76d92..a5791155fe065 100644
+--- a/drivers/net/wireless/ath/ath11k/debugfs.c
++++ b/drivers/net/wireless/ath/ath11k/debugfs.c
+@@ -1,7 +1,7 @@
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
+ /*
+  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
+- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
++ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+  */
+ #include <linux/vmalloc.h>
+@@ -96,7 +96,6 @@ void ath11k_debugfs_add_dbring_entry(struct ath11k *ar,
+ static void ath11k_debugfs_fw_stats_reset(struct ath11k *ar)
+ {
+       spin_lock_bh(&ar->data_lock);
+-      ar->fw_stats_done = false;
+       ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs);
+       ath11k_fw_stats_vdevs_free(&ar->fw_stats.vdevs);
+       spin_unlock_bh(&ar->data_lock);
+@@ -114,7 +113,7 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+       /* WMI_REQUEST_PDEV_STAT request has been already processed */
+       if (stats->stats_id == WMI_REQUEST_RSSI_PER_CHAIN_STAT) {
+-              ar->fw_stats_done = true;
++              complete(&ar->fw_stats_done);
+               return;
+       }
+@@ -138,7 +137,7 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+                                     &ar->fw_stats.vdevs);
+               if (is_end) {
+-                      ar->fw_stats_done = true;
++                      complete(&ar->fw_stats_done);
+                       num_vdev = 0;
+               }
+               return;
+@@ -158,7 +157,7 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+                                     &ar->fw_stats.bcn);
+               if (is_end) {
+-                      ar->fw_stats_done = true;
++                      complete(&ar->fw_stats_done);
+                       num_bcn = 0;
+               }
+       }
+@@ -168,21 +167,15 @@ static int ath11k_debugfs_fw_stats_request(struct ath11k *ar,
+                                          struct stats_request_params *req_param)
+ {
+       struct ath11k_base *ab = ar->ab;
+-      unsigned long timeout, time_left;
++      unsigned long time_left;
+       int ret;
+       lockdep_assert_held(&ar->conf_mutex);
+-      /* FW stats can get split when exceeding the stats data buffer limit.
+-       * In that case, since there is no end marking for the back-to-back
+-       * received 'update stats' event, we keep a 3 seconds timeout in case,
+-       * fw_stats_done is not marked yet
+-       */
+-      timeout = jiffies + secs_to_jiffies(3);
+-
+       ath11k_debugfs_fw_stats_reset(ar);
+       reinit_completion(&ar->fw_stats_complete);
++      reinit_completion(&ar->fw_stats_done);
+       ret = ath11k_wmi_send_stats_request_cmd(ar, req_param);
+@@ -193,21 +186,18 @@ static int ath11k_debugfs_fw_stats_request(struct ath11k *ar,
+       }
+       time_left = wait_for_completion_timeout(&ar->fw_stats_complete, 1 * HZ);
+-
+       if (!time_left)
+               return -ETIMEDOUT;
+-      for (;;) {
+-              if (time_after(jiffies, timeout))
+-                      break;
++      /* FW stats can get split when exceeding the stats data buffer limit.
++       * In that case, since there is no end marking for the back-to-back
++       * received 'update stats' event, we keep a 3 seconds timeout in case,
++       * fw_stats_done is not marked yet
++       */
++      time_left = wait_for_completion_timeout(&ar->fw_stats_done, 3 * HZ);
++      if (!time_left)
++              return -ETIMEDOUT;
+-              spin_lock_bh(&ar->data_lock);
+-              if (ar->fw_stats_done) {
+-                      spin_unlock_bh(&ar->data_lock);
+-                      break;
+-              }
+-              spin_unlock_bh(&ar->data_lock);
+-      }
+       return 0;
+ }
+diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
+index 8234e34269ed8..e5b4cc2486833 100644
+--- a/drivers/net/wireless/ath/ath11k/mac.c
++++ b/drivers/net/wireless/ath/ath11k/mac.c
+@@ -8510,11 +8510,11 @@ static int ath11k_fw_stats_request(struct ath11k *ar,
+       lockdep_assert_held(&ar->conf_mutex);
+       spin_lock_bh(&ar->data_lock);
+-      ar->fw_stats_done = false;
+       ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs);
+       spin_unlock_bh(&ar->data_lock);
+       reinit_completion(&ar->fw_stats_complete);
++      reinit_completion(&ar->fw_stats_done);
+       ret = ath11k_wmi_send_stats_request_cmd(ar, req_param);
+       if (ret) {
+diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
+index 142b201052660..38756ed48082c 100644
+--- a/drivers/net/wireless/ath/ath11k/wmi.c
++++ b/drivers/net/wireless/ath/ath11k/wmi.c
+@@ -7575,7 +7575,7 @@ static void ath11k_update_stats_event(struct ath11k_base *ab, struct sk_buff *sk
+        */
+       if (stats.stats_id == WMI_REQUEST_PDEV_STAT) {
+               list_splice_tail_init(&stats.pdevs, &ar->fw_stats.pdevs);
+-              ar->fw_stats_done = true;
++              complete(&ar->fw_stats_done);
+               goto complete;
+       }
+-- 
+2.39.5
+
diff --git a/queue-6.1/wifi-ath11k-convert-timeouts-to-secs_to_jiffies.patch b/queue-6.1/wifi-ath11k-convert-timeouts-to-secs_to_jiffies.patch
new file mode 100644 (file)
index 0000000..a0687f9
--- /dev/null
@@ -0,0 +1,120 @@
+From 18fac10cb0a40cf12020e32499d61b7b98d831fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Dec 2024 22:02:45 +0000
+Subject: wifi: ath11k: convert timeouts to secs_to_jiffies()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Easwar Hariharan <eahariha@linux.microsoft.com>
+
+[ Upstream commit b29425972c5234a59b6fb634125420ed74266377 ]
+
+Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced
+secs_to_jiffies().  As the value here is a multiple of 1000, use
+secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication.
+
+This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
+the following Coccinelle rules:
+
+@@ constant C; @@
+
+- msecs_to_jiffies(C * 1000)
++ secs_to_jiffies(C)
+
+@@ constant C; @@
+
+- msecs_to_jiffies(C * MSEC_PER_SEC)
++ secs_to_jiffies(C)
+
+Link: https://lkml.kernel.org/r/20241210-converge-secs-to-jiffies-v3-14-ddfefd7e9f2a@linux.microsoft.com
+Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
+Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
+Cc: Alexander Gordeev <agordeev@linux.ibm.com>
+Cc: Andrew Lunn <andrew+netdev@lunn.ch>
+Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
+Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
+Cc: Daniel Mack <daniel@zonque.org>
+Cc: David Airlie <airlied@gmail.com>
+Cc: David S. Miller <davem@davemloft.net>
+Cc: Dick Kennedy <dick.kennedy@broadcom.com>
+Cc: Eric Dumazet <edumazet@google.com>
+Cc: Florian Fainelli <florian.fainelli@broadcom.com>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
+Cc: Heiko Carstens <hca@linux.ibm.com>
+Cc: Ilya Dryomov <idryomov@gmail.com>
+Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
+Cc: Jakub Kicinski <kuba@kernel.org>
+Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
+Cc: James Smart <james.smart@broadcom.com>
+Cc: Jaroslav Kysela <perex@perex.cz>
+Cc: Jeff Johnson <jjohnson@kernel.org>
+Cc: Jens Axboe <axboe@kernel.dk>
+Cc: Jeroen de Borst <jeroendb@google.com>
+Cc: Jiri Kosina <jikos@kernel.org>
+Cc: Joe Lawrence <joe.lawrence@redhat.com>
+Cc: Johan Hedberg <johan.hedberg@gmail.com>
+Cc: Josh Poimboeuf <jpoimboe@kernel.org>
+Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
+Cc: Julia Lawall <julia.lawall@inria.fr>
+Cc: Kalle Valo <kvalo@kernel.org>
+Cc: Louis Peens <louis.peens@corigine.com>
+Cc: Lucas De Marchi <lucas.demarchi@intel.com>
+Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
+Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
+Cc: Marcel Holtmann <marcel@holtmann.org>
+Cc: Martin K. Petersen <martin.petersen@oracle.com>
+Cc: Maxime Ripard <mripard@kernel.org>
+Cc: Michael Ellerman <mpe@ellerman.id.au>
+Cc: Miroslav Benes <mbenes@suse.cz>
+Cc: Naveen N Rao <naveen@kernel.org>
+Cc: Nicholas Piggin <npiggin@gmail.com>
+Cc: Nicolas Palix <nicolas.palix@imag.fr>
+Cc: Oded Gabbay <ogabbay@kernel.org>
+Cc: Ofir Bitton <obitton@habana.ai>
+Cc: Pablo Neira Ayuso <pablo@netfilter.org>
+Cc: Paolo Abeni <pabeni@redhat.com>
+Cc: Petr Mladek <pmladek@suse.com>
+Cc: Praveen Kaligineedi <pkaligineedi@google.com>
+Cc: Ray Jui <rjui@broadcom.com>
+Cc: Robert Jarzmik <robert.jarzmik@free.fr>
+Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
+Cc: Roger Pau Monné <roger.pau@citrix.com>
+Cc: Russell King <linux@armlinux.org.uk>
+Cc: Scott Branden <sbranden@broadcom.com>
+Cc: Shailend Chand <shailend@google.com>
+Cc: Simona Vetter <simona@ffwll.ch>
+Cc: Simon Horman <horms@kernel.org>
+Cc: Sven Schnelle <svens@linux.ibm.com>
+Cc: Takashi Iwai <tiwai@suse.com>
+Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
+Cc: Thomas Zimmermann <tzimmermann@suse.de>
+Cc: Vasily Gorbik <gor@linux.ibm.com>
+Cc: Xiubo Li <xiubli@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Stable-dep-of: 9f6e82d11bb9 ("wifi: ath11k: avoid burning CPU in ath11k_debugfs_fw_stats_request()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/debugfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
+index 34aa04d27a1d7..a8bd944f76d92 100644
+--- a/drivers/net/wireless/ath/ath11k/debugfs.c
++++ b/drivers/net/wireless/ath/ath11k/debugfs.c
+@@ -178,7 +178,7 @@ static int ath11k_debugfs_fw_stats_request(struct ath11k *ar,
+        * received 'update stats' event, we keep a 3 seconds timeout in case,
+        * fw_stats_done is not marked yet
+        */
+-      timeout = jiffies + msecs_to_jiffies(3 * 1000);
++      timeout = jiffies + secs_to_jiffies(3);
+       ath11k_debugfs_fw_stats_reset(ar);
+-- 
+2.39.5
+
diff --git a/queue-6.1/wifi-ath11k-don-t-use-static-variables-in-ath11k_deb.patch b/queue-6.1/wifi-ath11k-don-t-use-static-variables-in-ath11k_deb.patch
new file mode 100644 (file)
index 0000000..34aef5b
--- /dev/null
@@ -0,0 +1,129 @@
+From f37ce2e68e41f92ed98e90cfae27563310d1c5e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Feb 2025 16:24:43 +0800
+Subject: wifi: ath11k: don't use static variables in
+ ath11k_debugfs_fw_stats_process()
+
+From: Baochen Qiang <quic_bqiang@quicinc.com>
+
+[ Upstream commit 2bcf73b2612dda7432f2c2eaad6679bd291791f2 ]
+
+Currently ath11k_debugfs_fw_stats_process() is using static variables to count
+firmware stat events. Taking num_vdev as an example, if for whatever reason (
+say ar->num_started_vdevs is 0 or firmware bug etc.) the following condition
+
+       (++num_vdev) == total_vdevs_started
+
+is not met, is_end is not set thus num_vdev won't be cleared. Next time when
+firmware stats is requested again, even if everything is working fine, we will
+fail due to the condition above will never be satisfied.
+
+The same applies to num_bcn as well.
+
+Change to use non-static counters so that we have a chance to clear them each
+time firmware stats is requested. Currently only ath11k_fw_stats_request() and
+ath11k_debugfs_fw_stats_request() are requesting firmware stats, so clear
+counters there.
+
+Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.37
+
+Fixes: da3a9d3c1576 ("ath11k: refactor debugfs code into debugfs.c")
+Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
+Acked-by: Kalle Valo <kvalo@kernel.org>
+Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
+Link: https://patch.msgid.link/20250220082448.31039-3-quic_bqiang@quicinc.com
+Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/core.h    |  2 ++
+ drivers/net/wireless/ath/ath11k/debugfs.c | 16 +++++++---------
+ drivers/net/wireless/ath/ath11k/mac.c     |  2 ++
+ 3 files changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
+index 69feef410b359..a46fe85e592d8 100644
+--- a/drivers/net/wireless/ath/ath11k/core.h
++++ b/drivers/net/wireless/ath/ath11k/core.h
+@@ -538,6 +538,8 @@ struct ath11k_fw_stats {
+       struct list_head pdevs;
+       struct list_head vdevs;
+       struct list_head bcn;
++      u32 num_vdev_recvd;
++      u32 num_bcn_recvd;
+ };
+ struct ath11k_dbg_htt_stats {
+diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
+index a5791155fe065..5a375d6680594 100644
+--- a/drivers/net/wireless/ath/ath11k/debugfs.c
++++ b/drivers/net/wireless/ath/ath11k/debugfs.c
+@@ -98,6 +98,8 @@ static void ath11k_debugfs_fw_stats_reset(struct ath11k *ar)
+       spin_lock_bh(&ar->data_lock);
+       ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs);
+       ath11k_fw_stats_vdevs_free(&ar->fw_stats.vdevs);
++      ar->fw_stats.num_vdev_recvd = 0;
++      ar->fw_stats.num_bcn_recvd = 0;
+       spin_unlock_bh(&ar->data_lock);
+ }
+@@ -106,7 +108,6 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+       struct ath11k_base *ab = ar->ab;
+       struct ath11k_pdev *pdev;
+       bool is_end;
+-      static unsigned int num_vdev, num_bcn;
+       size_t total_vdevs_started = 0;
+       int i;
+@@ -131,15 +132,14 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+                               total_vdevs_started += ar->num_started_vdevs;
+               }
+-              is_end = ((++num_vdev) == total_vdevs_started);
++              is_end = ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started);
+               list_splice_tail_init(&stats->vdevs,
+                                     &ar->fw_stats.vdevs);
+-              if (is_end) {
++              if (is_end)
+                       complete(&ar->fw_stats_done);
+-                      num_vdev = 0;
+-              }
++
+               return;
+       }
+@@ -151,15 +151,13 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+               /* Mark end until we reached the count of all started VDEVs
+                * within the PDEV
+                */
+-              is_end = ((++num_bcn) == ar->num_started_vdevs);
++              is_end = ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs);
+               list_splice_tail_init(&stats->bcn,
+                                     &ar->fw_stats.bcn);
+-              if (is_end) {
++              if (is_end)
+                       complete(&ar->fw_stats_done);
+-                      num_bcn = 0;
+-              }
+       }
+ }
+diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
+index e5b4cc2486833..8be42227dd943 100644
+--- a/drivers/net/wireless/ath/ath11k/mac.c
++++ b/drivers/net/wireless/ath/ath11k/mac.c
+@@ -8511,6 +8511,8 @@ static int ath11k_fw_stats_request(struct ath11k *ar,
+       spin_lock_bh(&ar->data_lock);
+       ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs);
++      ar->fw_stats.num_vdev_recvd = 0;
++      ar->fw_stats.num_bcn_recvd = 0;
+       spin_unlock_bh(&ar->data_lock);
+       reinit_completion(&ar->fw_stats_complete);
+-- 
+2.39.5
+
diff --git a/queue-6.1/wifi-ath11k-don-t-wait-when-there-is-no-vdev-started.patch b/queue-6.1/wifi-ath11k-don-t-wait-when-there-is-no-vdev-started.patch
new file mode 100644 (file)
index 0000000..8e04834
--- /dev/null
@@ -0,0 +1,76 @@
+From f2c829c8fe7d05aff6060f5779832dc808a83ab9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Feb 2025 16:24:44 +0800
+Subject: wifi: ath11k: don't wait when there is no vdev started
+
+From: Baochen Qiang <quic_bqiang@quicinc.com>
+
+[ Upstream commit 3b6d00fa883075dcaf49221538230e038a9c0b43 ]
+
+For WMI_REQUEST_VDEV_STAT request, firmware might split response into
+multiple events dut to buffer limit, hence currently in
+ath11k_debugfs_fw_stats_process() we wait until all events received.
+In case there is no vdev started, this results in that below condition
+would never get satisfied
+
+       ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started)
+
+finally the requestor would be blocked until wait time out.
+
+The same applies to WMI_REQUEST_BCN_STAT request as well due to:
+
+       ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs)
+
+Change to check the number of started vdev first: if it is zero, finish
+wait directly; if not, follow the old way.
+
+Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.37
+
+Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
+Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
+Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
+Link: https://patch.msgid.link/20250220082448.31039-4-quic_bqiang@quicinc.com
+Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/debugfs.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
+index 5a375d6680594..50bc17127e68a 100644
+--- a/drivers/net/wireless/ath/ath11k/debugfs.c
++++ b/drivers/net/wireless/ath/ath11k/debugfs.c
+@@ -107,7 +107,7 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+ {
+       struct ath11k_base *ab = ar->ab;
+       struct ath11k_pdev *pdev;
+-      bool is_end;
++      bool is_end = true;
+       size_t total_vdevs_started = 0;
+       int i;
+@@ -132,7 +132,9 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+                               total_vdevs_started += ar->num_started_vdevs;
+               }
+-              is_end = ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started);
++              if (total_vdevs_started)
++                      is_end = ((++ar->fw_stats.num_vdev_recvd) ==
++                                total_vdevs_started);
+               list_splice_tail_init(&stats->vdevs,
+                                     &ar->fw_stats.vdevs);
+@@ -151,7 +153,9 @@ void ath11k_debugfs_fw_stats_process(struct ath11k *ar, struct ath11k_fw_stats *
+               /* Mark end until we reached the count of all started VDEVs
+                * within the PDEV
+                */
+-              is_end = ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs);
++              if (ar->num_started_vdevs)
++                      is_end = ((++ar->fw_stats.num_bcn_recvd) ==
++                                ar->num_started_vdevs);
+               list_splice_tail_init(&stats->bcn,
+                                     &ar->fw_stats.bcn);
+-- 
+2.39.5
+
diff --git a/queue-6.1/wifi-ath11k-fix-soc_dp_stats-debugfs-file-permission.patch b/queue-6.1/wifi-ath11k-fix-soc_dp_stats-debugfs-file-permission.patch
new file mode 100644 (file)
index 0000000..880a38f
--- /dev/null
@@ -0,0 +1,56 @@
+From d8dd0b6dde42cc7f00de07a0f690a09d7d25c262 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Mar 2024 07:14:00 -0800
+Subject: wifi: ath11k: fix soc_dp_stats debugfs file permission
+
+From: Jeff Johnson <quic_jjohnson@quicinc.com>
+
+[ Upstream commit fa645e663165d69f05f95a0c3aa3b3d08f4fdeda ]
+
+Currently the soc_dp_stats debugfs file has the following permissions:
+
+-rw------- 1 root root 0 Mar  4 15:04 /sys/kernel/debug/ath11k/pci-0000:03:00.0/soc_dp_stats
+
+However this file does not actually support write operations -- no .write()
+method is registered. Therefore use the correct permissions when creating
+the file.
+
+After the change:
+
+-r-------- 1 root root 0 Mar  4 15:15 /sys/kernel/debug/ath11k/pci-0000:03:00.0/soc_dp_stats
+
+Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
+
+Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
+Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
+Link: https://msgid.link/20240305-fix-soc_dp_stats-permission-v1-1-2ec10b42f755@quicinc.com
+Stable-dep-of: 9f6e82d11bb9 ("wifi: ath11k: avoid burning CPU in ath11k_debugfs_fw_stats_request()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/debugfs.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
+index 5bb6fd17fdf6f..34aa04d27a1d7 100644
+--- a/drivers/net/wireless/ath/ath11k/debugfs.c
++++ b/drivers/net/wireless/ath/ath11k/debugfs.c
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
+ /*
+  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
++ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+  */
+ #include <linux/vmalloc.h>
+@@ -979,7 +980,7 @@ int ath11k_debugfs_pdev_create(struct ath11k_base *ab)
+       debugfs_create_file("simulate_fw_crash", 0600, ab->debugfs_soc, ab,
+                           &fops_simulate_fw_crash);
+-      debugfs_create_file("soc_dp_stats", 0600, ab->debugfs_soc, ab,
++      debugfs_create_file("soc_dp_stats", 0400, ab->debugfs_soc, ab,
+                           &fops_soc_dp_stats);
+       if (ab->hw_params.sram_dump.start != 0)
+-- 
+2.39.5
+
diff --git a/queue-6.1/wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch b/queue-6.1/wifi-ath11k-remove-unused-function-ath11k_tm_event_w.patch
new file mode 100644 (file)
index 0000000..d60c487
--- /dev/null
@@ -0,0 +1,140 @@
+From 4313069217863ed9e30f4f2245d77454727dfe78 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 May 2023 12:41:06 +0300
+Subject: wifi: ath11k: remove unused function ath11k_tm_event_wmi()
+
+From: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
+
+[ Upstream commit 86f85575a3f6a20cef1c8bb98e78585fe3a53ccc ]
+
+The function ath11k_tm_event_wmi() is only defined and it is not used
+anywhere. Hence remove the unused.
+
+Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
+
+Signed-off-by: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
+Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
+Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
+Link: https://lore.kernel.org/r/20230517135934.16408-2-quic_rajkbhag@quicinc.com
+Stable-dep-of: 9f6e82d11bb9 ("wifi: ath11k: avoid burning CPU in ath11k_debugfs_fw_stats_request()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/testmode.c | 64 +---------------------
+ drivers/net/wireless/ath/ath11k/testmode.h |  8 +--
+ 2 files changed, 2 insertions(+), 70 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/testmode.c b/drivers/net/wireless/ath/ath11k/testmode.c
+index 4bf1931adbaae..ebeca5eb6a67a 100644
+--- a/drivers/net/wireless/ath/ath11k/testmode.c
++++ b/drivers/net/wireless/ath/ath11k/testmode.c
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: BSD-3-Clause-Clear
+ /*
+  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+  */
+ #include "testmode.h"
+@@ -20,69 +21,6 @@ static const struct nla_policy ath11k_tm_policy[ATH11K_TM_ATTR_MAX + 1] = {
+       [ATH11K_TM_ATTR_VERSION_MINOR]  = { .type = NLA_U32 },
+ };
+-/* Returns true if callee consumes the skb and the skb should be discarded.
+- * Returns false if skb is not used. Does not sleep.
+- */
+-bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb)
+-{
+-      struct sk_buff *nl_skb;
+-      bool consumed;
+-      int ret;
+-
+-      ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
+-                 "testmode event wmi cmd_id %d skb %pK skb->len %d\n",
+-                 cmd_id, skb, skb->len);
+-
+-      ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len);
+-
+-      spin_lock_bh(&ar->data_lock);
+-
+-      consumed = true;
+-
+-      nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy,
+-                                                 2 * sizeof(u32) + skb->len,
+-                                                 GFP_ATOMIC);
+-      if (!nl_skb) {
+-              ath11k_warn(ar->ab,
+-                          "failed to allocate skb for testmode wmi event\n");
+-              goto out;
+-      }
+-
+-      ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI);
+-      if (ret) {
+-              ath11k_warn(ar->ab,
+-                          "failed to put testmode wmi event cmd attribute: %d\n",
+-                          ret);
+-              kfree_skb(nl_skb);
+-              goto out;
+-      }
+-
+-      ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id);
+-      if (ret) {
+-              ath11k_warn(ar->ab,
+-                          "failed to put testmode wmi even cmd_id: %d\n",
+-                          ret);
+-              kfree_skb(nl_skb);
+-              goto out;
+-      }
+-
+-      ret = nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data);
+-      if (ret) {
+-              ath11k_warn(ar->ab,
+-                          "failed to copy skb to testmode wmi event: %d\n",
+-                          ret);
+-              kfree_skb(nl_skb);
+-              goto out;
+-      }
+-
+-      cfg80211_testmode_event(nl_skb, GFP_ATOMIC);
+-
+-out:
+-      spin_unlock_bh(&ar->data_lock);
+-
+-      return consumed;
+-}
+-
+ static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[])
+ {
+       struct sk_buff *skb;
+diff --git a/drivers/net/wireless/ath/ath11k/testmode.h b/drivers/net/wireless/ath/ath11k/testmode.h
+index aaa122ed90697..ffdb0c30b276c 100644
+--- a/drivers/net/wireless/ath/ath11k/testmode.h
++++ b/drivers/net/wireless/ath/ath11k/testmode.h
+@@ -1,24 +1,18 @@
+ /* SPDX-License-Identifier: BSD-3-Clause-Clear */
+ /*
+  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
++ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+  */
+ #include "core.h"
+ #ifdef CONFIG_NL80211_TESTMODE
+-bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb);
+ int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                 void *data, int len);
+ #else
+-static inline bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id,
+-                                     struct sk_buff *skb)
+-{
+-      return false;
+-}
+-
+ static inline int ath11k_tm_cmd(struct ieee80211_hw *hw,
+                               struct ieee80211_vif *vif,
+                               void *data, int len)
+-- 
+2.39.5
+
diff --git a/queue-6.1/wifi-ath11k-validate-ath11k_crypto_mode-on-top-of-at.patch b/queue-6.1/wifi-ath11k-validate-ath11k_crypto_mode-on-top-of-at.patch
new file mode 100644 (file)
index 0000000..cc79520
--- /dev/null
@@ -0,0 +1,80 @@
+From 92671d703a01594652fa940ba26ced7cd036deb0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 May 2025 17:01:12 -0300
+Subject: wifi: ath11k: validate ath11k_crypto_mode on top of
+ ath11k_core_qmi_firmware_ready
+
+From: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
+
+[ Upstream commit b0d226a60856a1b765bb9a3848c7b2322fd08c47 ]
+
+if ath11k_crypto_mode is invalid (not ATH11K_CRYPT_MODE_SW/ATH11K_CRYPT_MODE_HW),
+ath11k_core_qmi_firmware_ready() will not undo some actions that was previously
+started/configured. Do the validation as soon as possible in order to avoid
+undoing actions in that case and also to fix the following smatch warning:
+
+drivers/net/wireless/ath/ath11k/core.c:2166 ath11k_core_qmi_firmware_ready()
+warn: missing unwind goto?
+
+Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Reported-by: Dan Carpenter <error27@gmail.com>
+Closes: https://lore.kernel.org/r/202304151955.oqAetVFd-lkp@intel.com/
+Fixes: aa2092a9bab3 ("ath11k: add raw mode and software crypto support")
+Reviewed-by: Baochen Qiang <quic_bqiang@quicinc.com>
+Link: https://patch.msgid.link/20250522200519.16858-1-rodrigo.gobbi.7@gmail.com
+Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/ath/ath11k/core.c | 28 +++++++++++++-------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
+index a8bdddccca4cb..0910d06ed296f 100644
+--- a/drivers/net/wireless/ath/ath11k/core.c
++++ b/drivers/net/wireless/ath/ath11k/core.c
+@@ -1517,6 +1517,20 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
+ {
+       int ret;
++      switch (ath11k_crypto_mode) {
++      case ATH11K_CRYPT_MODE_SW:
++              set_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
++              set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
++              break;
++      case ATH11K_CRYPT_MODE_HW:
++              clear_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
++              clear_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
++              break;
++      default:
++              ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
++              return -EINVAL;
++      }
++
+       ret = ath11k_core_start_firmware(ab, ATH11K_FIRMWARE_MODE_NORMAL);
+       if (ret) {
+               ath11k_err(ab, "failed to start firmware: %d\n", ret);
+@@ -1535,20 +1549,6 @@ int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab)
+               goto err_firmware_stop;
+       }
+-      switch (ath11k_crypto_mode) {
+-      case ATH11K_CRYPT_MODE_SW:
+-              set_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
+-              set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
+-              break;
+-      case ATH11K_CRYPT_MODE_HW:
+-              clear_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags);
+-              clear_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
+-              break;
+-      default:
+-              ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode);
+-              return -EINVAL;
+-      }
+-
+       if (ath11k_frame_mode == ATH11K_HW_TXRX_RAW)
+               set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags);
+-- 
+2.39.5
+