From fc30f4d6fc659f6f61be9cf32809b27b2b69f514 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 7 Jul 2024 10:53:22 -0400 Subject: [PATCH] Fixes for 6.6 Signed-off-by: Sasha Levin --- ...sallow-setting-handle-bigger-than-hc.patch | 66 ++++++ ...ent-fix-setting-of-unicast-qos-inter.patch | 99 ++++++++ ...gnore-too-large-handle-values-in-big.patch | 41 ++++ ...so-check-socket-flag-instead-of-hcon.patch | 72 ++++++ ...of-bounds-read-in-bond_option_arp_ip.patch | 79 +++++++ ...-s0ix-residency-on-corporate-systems.patch | 211 ++++++++++++++++++ ...-not-calculate-bgpio_bits-via-ngpios.patch | 55 +++++ ...ib-of-add-polarity-quirk-for-tsc2005.patch | 46 ++++ ...-of-fix-lookup-quirk-for-mips-lantiq.patch | 70 ++++++ ...lize-pad-field-in-struct-inet_diag_r.patch | 117 ++++++++++ queue-6.6/kvm-s390-fix-lpswey-handling.patch | 130 +++++++++++ ...me-calculation-in-ieee802154_configu.patch | 62 +++++ ...ards-fix-double-memory-deallocation-.patch | 46 ++++ ...tagram_iter-to-be-called-from-any-co.patch | 60 +++++ ...witch-create-ingress-acl-when-needed.patch | 122 ++++++++++ ...prio_rl-cleanup-and-free-in-mlx5e_pr.patch | 43 ++++ ...ove-ntb_netdev_rx_handler-to-call-ne.patch | 79 +++++++ ...ce-fix-phy-led-blinking-code-comment.patch | 40 ++++ ...lize-num_q_vectors-for-msi-intx-inte.patch | 36 +++ ...les-unconditionally-flush-pending-wo.patch | 62 +++++ ...c-avoid-deadlock-in-kexec-crash-path.patch | 58 +++++ ...sts-fix-oom-in-msg_zerocopy-selftest.patch | 101 +++++++++ ...rder-checking-verbose-in-msg_zerocop.patch | 40 ++++ queue-6.6/series | 27 +++ ..._metrics-validate-source-addr-length.patch | 38 ++++ ...-dsack-undo-in-fast-recovery-to-call.patch | 70 ++++++ ...strict-nl80211_attr_txq_quantum-valu.patch | 123 ++++++++++ ...000-fix-ies_len-type-in-connect-path.patch | 51 +++++ 28 files changed, 2044 insertions(+) create mode 100644 queue-6.6/bluetooth-hci-disallow-setting-handle-bigger-than-hc.patch create mode 100644 queue-6.6/bluetooth-hci_event-fix-setting-of-unicast-qos-inter.patch create mode 100644 queue-6.6/bluetooth-ignore-too-large-handle-values-in-big.patch create mode 100644 queue-6.6/bluetooth-iso-check-socket-flag-instead-of-hcon.patch create mode 100644 queue-6.6/bonding-fix-out-of-bounds-read-in-bond_option_arp_ip.patch create mode 100644 queue-6.6/e1000e-fix-s0ix-residency-on-corporate-systems.patch create mode 100644 queue-6.6/gpio-mmio-do-not-calculate-bgpio_bits-via-ngpios.patch create mode 100644 queue-6.6/gpiolib-of-add-polarity-quirk-for-tsc2005.patch create mode 100644 queue-6.6/gpiolib-of-fix-lookup-quirk-for-mips-lantiq.patch create mode 100644 queue-6.6/inet_diag-initialize-pad-field-in-struct-inet_diag_r.patch create mode 100644 queue-6.6/kvm-s390-fix-lpswey-handling.patch create mode 100644 queue-6.6/mac802154-fix-time-calculation-in-ieee802154_configu.patch create mode 100644 queue-6.6/mlxsw-core_linecards-fix-double-memory-deallocation-.patch create mode 100644 queue-6.6/net-allow-skb_datagram_iter-to-be-called-from-any-co.patch create mode 100644 queue-6.6/net-mlx5-e-switch-create-ingress-acl-when-needed.patch create mode 100644 queue-6.6/net-mlx5e-add-mqprio_rl-cleanup-and-free-in-mlx5e_pr.patch create mode 100644 queue-6.6/net-ntb_netdev-move-ntb_netdev_rx_handler-to-call-ne.patch create mode 100644 queue-6.6/net-phy-phy_device-fix-phy-led-blinking-code-comment.patch create mode 100644 queue-6.6/net-txgbe-initialize-num_q_vectors-for-msi-intx-inte.patch create mode 100644 queue-6.6/netfilter-nf_tables-unconditionally-flush-pending-wo.patch create mode 100644 queue-6.6/riscv-kexec-avoid-deadlock-in-kexec-crash-path.patch create mode 100644 queue-6.6/selftests-fix-oom-in-msg_zerocopy-selftest.patch create mode 100644 queue-6.6/selftests-make-order-checking-verbose-in-msg_zerocop.patch create mode 100644 queue-6.6/tcp_metrics-validate-source-addr-length.patch create mode 100644 queue-6.6/upstream-tcp-fix-dsack-undo-in-fast-recovery-to-call.patch create mode 100644 queue-6.6/wifi-cfg80211-restrict-nl80211_attr_txq_quantum-valu.patch create mode 100644 queue-6.6/wifi-wilc1000-fix-ies_len-type-in-connect-path.patch diff --git a/queue-6.6/bluetooth-hci-disallow-setting-handle-bigger-than-hc.patch b/queue-6.6/bluetooth-hci-disallow-setting-handle-bigger-than-hc.patch new file mode 100644 index 00000000000..80ae662cacc --- /dev/null +++ b/queue-6.6/bluetooth-hci-disallow-setting-handle-bigger-than-hc.patch @@ -0,0 +1,66 @@ +From dda18271c81d5e331038faf0f3ca93208779b8c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jun 2024 22:27:47 +0300 +Subject: bluetooth/hci: disallow setting handle bigger than + HCI_CONN_HANDLE_MAX + +From: Pavel Skripkin + +[ Upstream commit 1cc18c2ab2e8c54c355ea7c0423a636e415a0c23 ] + +Syzbot hit warning in hci_conn_del() caused by freeing handle that was +not allocated using ida allocator. + +This is caused by handle bigger than HCI_CONN_HANDLE_MAX passed by +hci_le_big_sync_established_evt(), which makes code think it's unset +connection. + +Add same check for handle upper bound as in hci_conn_set_handle() to +prevent warning. + +Link: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474 +Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com +Fixes: 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique") +Signed-off-by: Pavel Skripkin +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/hci_conn.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c +index 163b56a68bb04..9c670348fac42 100644 +--- a/net/bluetooth/hci_conn.c ++++ b/net/bluetooth/hci_conn.c +@@ -935,8 +935,8 @@ static int hci_conn_hash_alloc_unset(struct hci_dev *hdev) + U16_MAX, GFP_ATOMIC); + } + +-struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, +- u8 role, u16 handle) ++static struct hci_conn *__hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, ++ u8 role, u16 handle) + { + struct hci_conn *conn; + +@@ -1077,7 +1077,16 @@ struct hci_conn *hci_conn_add_unset(struct hci_dev *hdev, int type, + if (unlikely(handle < 0)) + return ERR_PTR(-ECONNREFUSED); + +- return hci_conn_add(hdev, type, dst, role, handle); ++ return __hci_conn_add(hdev, type, dst, role, handle); ++} ++ ++struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, ++ u8 role, u16 handle) ++{ ++ if (handle > HCI_CONN_HANDLE_MAX) ++ return ERR_PTR(-EINVAL); ++ ++ return __hci_conn_add(hdev, type, dst, role, handle); + } + + static void hci_conn_cleanup_child(struct hci_conn *conn, u8 reason) +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-hci_event-fix-setting-of-unicast-qos-inter.patch b/queue-6.6/bluetooth-hci_event-fix-setting-of-unicast-qos-inter.patch new file mode 100644 index 00000000000..e8a0a4df201 --- /dev/null +++ b/queue-6.6/bluetooth-hci_event-fix-setting-of-unicast-qos-inter.patch @@ -0,0 +1,99 @@ +From d34ce9404f29b570f4f1cbcb8b446c4192079df7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Jun 2024 12:04:30 -0400 +Subject: Bluetooth: hci_event: Fix setting of unicast qos interval +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Luiz Augusto von Dentz + +[ Upstream commit ac65ecccae802417ce42e857defacad60e4b8329 ] + +qos->ucast interval reffers to the SDU interval, and should not +be set to the interval value reported by the LE CIS Established +event since the latter reffers to the ISO interval. These two +interval are not the same thing: + +BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 6, Part G + +Isochronous interval: +The time between two consecutive BIS or CIS events (designated +ISO_Interval in the Link Layer) + +SDU interval: +The nominal time between two consecutive SDUs that are sent or +received by the upper layer. + +So this instead uses the following formula from the spec to calculate +the resulting SDU interface: + +BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 6, Part G +page 3075: + +Transport_Latency_C_To_P = CIG_Sync_Delay + (FT_C_To_P) × +ISO_Interval + SDU_Interval_C_To_P +Transport_Latency_P_To_C = CIG_Sync_Delay + (FT_P_To_C) × +ISO_Interval + SDU_Interval_P_To_C + +Link: https://github.com/bluez/bluez/issues/823 +Fixes: 2be22f1941d5 ("Bluetooth: hci_event: Fix parsing of CIS Established Event") +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/hci_event.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c +index 6ce4f812503f4..ffb7d43597a2d 100644 +--- a/net/bluetooth/hci_event.c ++++ b/net/bluetooth/hci_event.c +@@ -6646,6 +6646,7 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, + struct bt_iso_qos *qos; + bool pending = false; + u16 handle = __le16_to_cpu(ev->handle); ++ u32 c_sdu_interval, p_sdu_interval; + + bt_dev_dbg(hdev, "status 0x%2.2x", ev->status); + +@@ -6670,12 +6671,25 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, + + pending = test_and_clear_bit(HCI_CONN_CREATE_CIS, &conn->flags); + +- /* Convert ISO Interval (1.25 ms slots) to SDU Interval (us) */ +- qos->ucast.in.interval = le16_to_cpu(ev->interval) * 1250; +- qos->ucast.out.interval = qos->ucast.in.interval; ++ /* BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 6, Part G ++ * page 3075: ++ * Transport_Latency_C_To_P = CIG_Sync_Delay + (FT_C_To_P) × ++ * ISO_Interval + SDU_Interval_C_To_P ++ * ... ++ * SDU_Interval = (CIG_Sync_Delay + (FT) x ISO_Interval) - ++ * Transport_Latency ++ */ ++ c_sdu_interval = (get_unaligned_le24(ev->cig_sync_delay) + ++ (ev->c_ft * le16_to_cpu(ev->interval) * 1250)) - ++ get_unaligned_le24(ev->c_latency); ++ p_sdu_interval = (get_unaligned_le24(ev->cig_sync_delay) + ++ (ev->p_ft * le16_to_cpu(ev->interval) * 1250)) - ++ get_unaligned_le24(ev->p_latency); + + switch (conn->role) { + case HCI_ROLE_SLAVE: ++ qos->ucast.in.interval = c_sdu_interval; ++ qos->ucast.out.interval = p_sdu_interval; + /* Convert Transport Latency (us) to Latency (msec) */ + qos->ucast.in.latency = + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), +@@ -6689,6 +6703,8 @@ static void hci_le_cis_estabilished_evt(struct hci_dev *hdev, void *data, + qos->ucast.out.phy = ev->p_phy; + break; + case HCI_ROLE_MASTER: ++ qos->ucast.in.interval = p_sdu_interval; ++ qos->ucast.out.interval = c_sdu_interval; + /* Convert Transport Latency (us) to Latency (msec) */ + qos->ucast.out.latency = + DIV_ROUND_CLOSEST(get_unaligned_le24(ev->c_latency), +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-ignore-too-large-handle-values-in-big.patch b/queue-6.6/bluetooth-ignore-too-large-handle-values-in-big.patch new file mode 100644 index 00000000000..b862317f40d --- /dev/null +++ b/queue-6.6/bluetooth-ignore-too-large-handle-values-in-big.patch @@ -0,0 +1,41 @@ +From 7b701f28d079852f6e49bdbfe2d5ca6472464b58 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jun 2024 19:09:37 +0800 +Subject: Bluetooth: Ignore too large handle values in BIG + +From: Edward Adam Davis + +[ Upstream commit 015d79c96d62cd8a4a359fcf5be40d58088c936b ] + +hci_le_big_sync_established_evt is necessary to filter out cases where the +handle value is belonging to ida id range, otherwise ida will be erroneously +released in hci_conn_cleanup. + +Fixes: 181a42edddf5 ("Bluetooth: Make handle of hci_conn be unique") +Reported-by: syzbot+b2545b087a01a7319474@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=b2545b087a01a7319474 +Signed-off-by: Edward Adam Davis +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/hci_event.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c +index ffb7d43597a2d..727f040b65297 100644 +--- a/net/bluetooth/hci_event.c ++++ b/net/bluetooth/hci_event.c +@@ -6905,6 +6905,10 @@ static void hci_le_big_sync_established_evt(struct hci_dev *hdev, void *data, + + bis = hci_conn_hash_lookup_handle(hdev, handle); + if (!bis) { ++ if (handle > HCI_CONN_HANDLE_MAX) { ++ bt_dev_dbg(hdev, "ignore too large handle %u", handle); ++ continue; ++ } + bis = hci_conn_add(hdev, ISO_LINK, BDADDR_ANY, + HCI_ROLE_SLAVE, handle); + if (IS_ERR(bis)) +-- +2.43.0 + diff --git a/queue-6.6/bluetooth-iso-check-socket-flag-instead-of-hcon.patch b/queue-6.6/bluetooth-iso-check-socket-flag-instead-of-hcon.patch new file mode 100644 index 00000000000..28094c9a10a --- /dev/null +++ b/queue-6.6/bluetooth-iso-check-socket-flag-instead-of-hcon.patch @@ -0,0 +1,72 @@ +From 4c8285b275c0e44b8c5f790ebaa3ec9843f9158b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Jun 2024 13:33:24 +0300 +Subject: Bluetooth: ISO: Check socket flag instead of hcon + +From: Iulia Tanasescu + +[ Upstream commit 596b6f081336e77764ca35cfeab66d0fcdbe544e ] + +This fixes the following Smatch static checker warning: + +net/bluetooth/iso.c:1364 iso_sock_recvmsg() +error: we previously assumed 'pi->conn->hcon' could be null (line 1359) + +net/bluetooth/iso.c +1347 static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg, +1348 size_t len, int flags) +1349 { +1350 struct sock *sk = sock->sk; +1351 struct iso_pinfo *pi = iso_pi(sk); +1352 +1353 BT_DBG("sk %p", sk); +1354 +1355 if (test_and_clear_bit(BT_SK_DEFER_SETUP, + &bt_sk(sk)->flags)) { +1356 lock_sock(sk); +1357 switch (sk->sk_state) { +1358 case BT_CONNECT2: +1359 if (pi->conn->hcon && + ^^^^^^^^^^^^^^ If ->hcon is NULL + +1360 test_bit(HCI_CONN_PA_SYNC, + &pi->conn->hcon->flags)) { +1361 iso_conn_big_sync(sk); +1362 sk->sk_state = BT_LISTEN; +1363 } else { +--> 1364 iso_conn_defer_accept(pi->conn->hcon); + ^^^^^^^^^^^^^^ + then we're toast + +1365 sk->sk_state = BT_CONFIG; +1366 } +1367 release_sock(sk); +1368 return 0; +1369 case BT_CONNECTED: +1370 if (test_bit(BT_SK_PA_SYNC, + +Fixes: fbdc4bc47268 ("Bluetooth: ISO: Use defer setup to separate PA sync and BIG sync") +Signed-off-by: Iulia Tanasescu +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/iso.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c +index 05b9edb480f09..3ccba592f7349 100644 +--- a/net/bluetooth/iso.c ++++ b/net/bluetooth/iso.c +@@ -1233,8 +1233,7 @@ static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg, + lock_sock(sk); + switch (sk->sk_state) { + case BT_CONNECT2: +- if (pi->conn->hcon && +- test_bit(HCI_CONN_PA_SYNC, &pi->conn->hcon->flags)) { ++ if (test_bit(BT_SK_PA_SYNC, &pi->flags)) { + iso_conn_big_sync(sk); + sk->sk_state = BT_LISTEN; + } else { +-- +2.43.0 + diff --git a/queue-6.6/bonding-fix-out-of-bounds-read-in-bond_option_arp_ip.patch b/queue-6.6/bonding-fix-out-of-bounds-read-in-bond_option_arp_ip.patch new file mode 100644 index 00000000000..f9b2fef3c06 --- /dev/null +++ b/queue-6.6/bonding-fix-out-of-bounds-read-in-bond_option_arp_ip.patch @@ -0,0 +1,79 @@ +From 69b45ea53a4756a833cf0c586892ca931318430b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jul 2024 14:55:55 +0100 +Subject: bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set() + +From: Sam Sun + +[ Upstream commit e271ff53807e8f2c628758290f0e499dbe51cb3d ] + +In function bond_option_arp_ip_targets_set(), if newval->string is an +empty string, newval->string+1 will point to the byte after the +string, causing an out-of-bound read. + +BUG: KASAN: slab-out-of-bounds in strlen+0x7d/0xa0 lib/string.c:418 +Read of size 1 at addr ffff8881119c4781 by task syz-executor665/8107 +CPU: 1 PID: 8107 Comm: syz-executor665 Not tainted 6.7.0-rc7 #1 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 +Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 + print_address_description mm/kasan/report.c:364 [inline] + print_report+0xc1/0x5e0 mm/kasan/report.c:475 + kasan_report+0xbe/0xf0 mm/kasan/report.c:588 + strlen+0x7d/0xa0 lib/string.c:418 + __fortify_strlen include/linux/fortify-string.h:210 [inline] + in4_pton+0xa3/0x3f0 net/core/utils.c:130 + bond_option_arp_ip_targets_set+0xc2/0x910 +drivers/net/bonding/bond_options.c:1201 + __bond_opt_set+0x2a4/0x1030 drivers/net/bonding/bond_options.c:767 + __bond_opt_set_notify+0x48/0x150 drivers/net/bonding/bond_options.c:792 + bond_opt_tryset_rtnl+0xda/0x160 drivers/net/bonding/bond_options.c:817 + bonding_sysfs_store_option+0xa1/0x120 drivers/net/bonding/bond_sysfs.c:156 + dev_attr_store+0x54/0x80 drivers/base/core.c:2366 + sysfs_kf_write+0x114/0x170 fs/sysfs/file.c:136 + kernfs_fop_write_iter+0x337/0x500 fs/kernfs/file.c:334 + call_write_iter include/linux/fs.h:2020 [inline] + new_sync_write fs/read_write.c:491 [inline] + vfs_write+0x96a/0xd80 fs/read_write.c:584 + ksys_write+0x122/0x250 fs/read_write.c:637 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x63/0x6b +---[ end trace ]--- + +Fix it by adding a check of string length before using it. + +Fixes: f9de11a16594 ("bonding: add ip checks when store ip target") +Signed-off-by: Yue Sun +Signed-off-by: Simon Horman +Acked-by: Jay Vosburgh +Reviewed-by: Hangbin Liu +Link: https://patch.msgid.link/20240702-bond-oob-v6-1-2dfdba195c19@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/bonding/bond_options.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c +index f3f27f0bd2a6c..00a662f8edd6b 100644 +--- a/drivers/net/bonding/bond_options.c ++++ b/drivers/net/bonding/bond_options.c +@@ -1198,9 +1198,9 @@ static int bond_option_arp_ip_targets_set(struct bonding *bond, + __be32 target; + + if (newval->string) { +- if (!in4_pton(newval->string+1, -1, (u8 *)&target, -1, NULL)) { +- netdev_err(bond->dev, "invalid ARP target %pI4 specified\n", +- &target); ++ if (strlen(newval->string) < 1 || ++ !in4_pton(newval->string + 1, -1, (u8 *)&target, -1, NULL)) { ++ netdev_err(bond->dev, "invalid ARP target specified\n"); + return ret; + } + if (newval->string[0] == '+') +-- +2.43.0 + diff --git a/queue-6.6/e1000e-fix-s0ix-residency-on-corporate-systems.patch b/queue-6.6/e1000e-fix-s0ix-residency-on-corporate-systems.patch new file mode 100644 index 00000000000..9a8720cecb4 --- /dev/null +++ b/queue-6.6/e1000e-fix-s0ix-residency-on-corporate-systems.patch @@ -0,0 +1,211 @@ +From ce242ae7db6922c3b964deb0ce4f40592a8b0519 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Jun 2024 13:17:53 -0700 +Subject: e1000e: Fix S0ix residency on corporate systems + +From: Dima Ruinskiy + +[ Upstream commit c93a6f62cb1bd097aef2e4588648a420d175eee2 ] + +On vPro systems, the configuration of the I219-LM to achieve power +gating and S0ix residency is split between the driver and the CSME FW. +It was discovered that in some scenarios, where the network cable is +connected and then disconnected, S0ix residency is not always reached. +This was root-caused to a subset of I219-LM register writes that are not +performed by the CSME FW. Therefore, the driver should perform these +register writes on corporate setups, regardless of the CSME FW state. + +This was discovered on Meteor Lake systems; however it is likely to +appear on other platforms as well. + +Fixes: cc23f4f0b6b9 ("e1000e: Add support for Meteor Lake") +Link: https://bugzilla.kernel.org/show_bug.cgi?id=218589 +Signed-off-by: Dima Ruinskiy +Signed-off-by: Vitaly Lifshits +Signed-off-by: Tony Nguyen +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20240628201754.2744221-1-anthony.l.nguyen@intel.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/e1000e/netdev.c | 132 ++++++++++----------- + 1 file changed, 66 insertions(+), 66 deletions(-) + +diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c +index 3692fce201959..334f652c60601 100644 +--- a/drivers/net/ethernet/intel/e1000e/netdev.c ++++ b/drivers/net/ethernet/intel/e1000e/netdev.c +@@ -6363,49 +6363,49 @@ static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter) + mac_data |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; + ew32(EXTCNF_CTRL, mac_data); + +- /* Enable the Dynamic Power Gating in the MAC */ +- mac_data = er32(FEXTNVM7); +- mac_data |= BIT(22); +- ew32(FEXTNVM7, mac_data); +- + /* Disable disconnected cable conditioning for Power Gating */ + mac_data = er32(DPGFR); + mac_data |= BIT(2); + ew32(DPGFR, mac_data); + +- /* Don't wake from dynamic Power Gating with clock request */ +- mac_data = er32(FEXTNVM12); +- mac_data |= BIT(12); +- ew32(FEXTNVM12, mac_data); +- +- /* Ungate PGCB clock */ +- mac_data = er32(FEXTNVM9); +- mac_data &= ~BIT(28); +- ew32(FEXTNVM9, mac_data); +- +- /* Enable K1 off to enable mPHY Power Gating */ +- mac_data = er32(FEXTNVM6); +- mac_data |= BIT(31); +- ew32(FEXTNVM6, mac_data); +- +- /* Enable mPHY power gating for any link and speed */ +- mac_data = er32(FEXTNVM8); +- mac_data |= BIT(9); +- ew32(FEXTNVM8, mac_data); +- + /* Enable the Dynamic Clock Gating in the DMA and MAC */ + mac_data = er32(CTRL_EXT); + mac_data |= E1000_CTRL_EXT_DMA_DYN_CLK_EN; + ew32(CTRL_EXT, mac_data); +- +- /* No MAC DPG gating SLP_S0 in modern standby +- * Switch the logic of the lanphypc to use PMC counter +- */ +- mac_data = er32(FEXTNVM5); +- mac_data |= BIT(7); +- ew32(FEXTNVM5, mac_data); + } + ++ /* Enable the Dynamic Power Gating in the MAC */ ++ mac_data = er32(FEXTNVM7); ++ mac_data |= BIT(22); ++ ew32(FEXTNVM7, mac_data); ++ ++ /* Don't wake from dynamic Power Gating with clock request */ ++ mac_data = er32(FEXTNVM12); ++ mac_data |= BIT(12); ++ ew32(FEXTNVM12, mac_data); ++ ++ /* Ungate PGCB clock */ ++ mac_data = er32(FEXTNVM9); ++ mac_data &= ~BIT(28); ++ ew32(FEXTNVM9, mac_data); ++ ++ /* Enable K1 off to enable mPHY Power Gating */ ++ mac_data = er32(FEXTNVM6); ++ mac_data |= BIT(31); ++ ew32(FEXTNVM6, mac_data); ++ ++ /* Enable mPHY power gating for any link and speed */ ++ mac_data = er32(FEXTNVM8); ++ mac_data |= BIT(9); ++ ew32(FEXTNVM8, mac_data); ++ ++ /* No MAC DPG gating SLP_S0 in modern standby ++ * Switch the logic of the lanphypc to use PMC counter ++ */ ++ mac_data = er32(FEXTNVM5); ++ mac_data |= BIT(7); ++ ew32(FEXTNVM5, mac_data); ++ + /* Disable the time synchronization clock */ + mac_data = er32(FEXTNVM7); + mac_data |= BIT(31); +@@ -6498,33 +6498,6 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) + } else { + /* Request driver unconfigure the device from S0ix */ + +- /* Disable the Dynamic Power Gating in the MAC */ +- mac_data = er32(FEXTNVM7); +- mac_data &= 0xFFBFFFFF; +- ew32(FEXTNVM7, mac_data); +- +- /* Disable mPHY power gating for any link and speed */ +- mac_data = er32(FEXTNVM8); +- mac_data &= ~BIT(9); +- ew32(FEXTNVM8, mac_data); +- +- /* Disable K1 off */ +- mac_data = er32(FEXTNVM6); +- mac_data &= ~BIT(31); +- ew32(FEXTNVM6, mac_data); +- +- /* Disable Ungate PGCB clock */ +- mac_data = er32(FEXTNVM9); +- mac_data |= BIT(28); +- ew32(FEXTNVM9, mac_data); +- +- /* Cancel not waking from dynamic +- * Power Gating with clock request +- */ +- mac_data = er32(FEXTNVM12); +- mac_data &= ~BIT(12); +- ew32(FEXTNVM12, mac_data); +- + /* Cancel disable disconnected cable conditioning + * for Power Gating + */ +@@ -6537,13 +6510,6 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) + mac_data &= 0xFFF7FFFF; + ew32(CTRL_EXT, mac_data); + +- /* Revert the lanphypc logic to use the internal Gbe counter +- * and not the PMC counter +- */ +- mac_data = er32(FEXTNVM5); +- mac_data &= 0xFFFFFF7F; +- ew32(FEXTNVM5, mac_data); +- + /* Enable the periodic inband message, + * Request PCIe clock in K1 page770_17[10:9] =01b + */ +@@ -6581,6 +6547,40 @@ static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter) + mac_data &= ~BIT(31); + mac_data |= BIT(0); + ew32(FEXTNVM7, mac_data); ++ ++ /* Disable the Dynamic Power Gating in the MAC */ ++ mac_data = er32(FEXTNVM7); ++ mac_data &= 0xFFBFFFFF; ++ ew32(FEXTNVM7, mac_data); ++ ++ /* Disable mPHY power gating for any link and speed */ ++ mac_data = er32(FEXTNVM8); ++ mac_data &= ~BIT(9); ++ ew32(FEXTNVM8, mac_data); ++ ++ /* Disable K1 off */ ++ mac_data = er32(FEXTNVM6); ++ mac_data &= ~BIT(31); ++ ew32(FEXTNVM6, mac_data); ++ ++ /* Disable Ungate PGCB clock */ ++ mac_data = er32(FEXTNVM9); ++ mac_data |= BIT(28); ++ ew32(FEXTNVM9, mac_data); ++ ++ /* Cancel not waking from dynamic ++ * Power Gating with clock request ++ */ ++ mac_data = er32(FEXTNVM12); ++ mac_data &= ~BIT(12); ++ ew32(FEXTNVM12, mac_data); ++ ++ /* Revert the lanphypc logic to use the internal Gbe counter ++ * and not the PMC counter ++ */ ++ mac_data = er32(FEXTNVM5); ++ mac_data &= 0xFFFFFF7F; ++ ew32(FEXTNVM5, mac_data); + } + + static int e1000e_pm_freeze(struct device *dev) +-- +2.43.0 + diff --git a/queue-6.6/gpio-mmio-do-not-calculate-bgpio_bits-via-ngpios.patch b/queue-6.6/gpio-mmio-do-not-calculate-bgpio_bits-via-ngpios.patch new file mode 100644 index 00000000000..a127ce96c1a --- /dev/null +++ b/queue-6.6/gpio-mmio-do-not-calculate-bgpio_bits-via-ngpios.patch @@ -0,0 +1,55 @@ +From 447dde3415d410ab9134368a6bee82478d83ac02 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jun 2024 09:19:49 +0800 +Subject: gpio: mmio: do not calculate bgpio_bits via "ngpios" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Shiji Yang + +[ Upstream commit f07798d7bb9c46d17d80103fb772fd2c75d47919 ] + +bgpio_bits must be aligned with the data bus width. For example, on a +32 bit big endian system and we only have 16 GPIOs. If we only assume +bgpio_bits=16 we can never control the GPIO because the base address +is the lowest address. + +low address high address +------------------------------------------------- +| byte3 | byte2 | byte1 | byte0 | +------------------------------------------------- +| NaN | NaN | gpio8-15 | gpio0-7 | +------------------------------------------------- + +Fixes: 55b2395e4e92 ("gpio: mmio: handle "ngpios" properly in bgpio_init()") +Fixes: https://github.com/openwrt/openwrt/issues/15739 +Reported-by: Mark Mentovai +Signed-off-by: Shiji Yang +Suggested-By: Mark Mentovai +Reviewed-by: Jonas Gorski +Tested-by: Lóránd Horváth +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/TYCP286MB089577B47D70F0AB25ABA6F5BCD52@TYCP286MB0895.JPNP286.PROD.OUTLOOK.COM +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-mmio.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c +index 74fdf0d87b2c8..c9f9f4e36c89b 100644 +--- a/drivers/gpio/gpio-mmio.c ++++ b/drivers/gpio/gpio-mmio.c +@@ -622,8 +622,6 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev, + ret = gpiochip_get_ngpios(gc, dev); + if (ret) + gc->ngpio = gc->bgpio_bits; +- else +- gc->bgpio_bits = roundup_pow_of_two(round_up(gc->ngpio, 8)); + + ret = bgpio_setup_io(gc, dat, set, clr, flags); + if (ret) +-- +2.43.0 + diff --git a/queue-6.6/gpiolib-of-add-polarity-quirk-for-tsc2005.patch b/queue-6.6/gpiolib-of-add-polarity-quirk-for-tsc2005.patch new file mode 100644 index 00000000000..1b5da8c4bcf --- /dev/null +++ b/queue-6.6/gpiolib-of-add-polarity-quirk-for-tsc2005.patch @@ -0,0 +1,46 @@ +From 60c47ec7f7c1bd666463ca273408c22e2fe75275 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jul 2024 11:26:09 -0700 +Subject: gpiolib: of: add polarity quirk for TSC2005 + +From: Dmitry Torokhov + +[ Upstream commit f8d76c2c313c56d5cb894a243dff4550f048278d ] + +DTS for Nokia N900 incorrectly specifies "active high" polarity for +the reset line, while the chip documentation actually specifies it as +"active low". In the past the driver fudged gpiod API and inverted +the logic internally, but it was changed in d0d89493bff8. + +Fixes: d0d89493bff8 ("Input: tsc2004/5 - switch to using generic device properties") +Signed-off-by: Dmitry Torokhov +Acked-by: Linus Walleij +Link: https://lore.kernel.org/r/ZoWXwYtwgJIxi-hD@google.com +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpiolib-of.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c +index 133d2a4c31a6d..cec9e8f29bbdf 100644 +--- a/drivers/gpio/gpiolib-of.c ++++ b/drivers/gpio/gpiolib-of.c +@@ -202,6 +202,14 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, + * for the property. + */ + { "lantiq,pci-xway", "gpio-reset", false }, ++#endif ++#if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2005) ++ /* ++ * DTS for Nokia N900 incorrectly specified "active high" ++ * polarity for the reset line, while the chip actually ++ * treats it as "active low". ++ */ ++ { "ti,tsc2005", "reset-gpios", false }, + #endif + }; + unsigned int i; +-- +2.43.0 + diff --git a/queue-6.6/gpiolib-of-fix-lookup-quirk-for-mips-lantiq.patch b/queue-6.6/gpiolib-of-fix-lookup-quirk-for-mips-lantiq.patch new file mode 100644 index 00000000000..5007451e81c --- /dev/null +++ b/queue-6.6/gpiolib-of-fix-lookup-quirk-for-mips-lantiq.patch @@ -0,0 +1,70 @@ +From 5128b4508cf8cfc31f848e364b6b3404678b4487 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jul 2024 10:38:50 -0700 +Subject: gpiolib: of: fix lookup quirk for MIPS Lantiq + +From: Dmitry Torokhov + +[ Upstream commit 3645ffaf2b334abaf5f53e5ca0f47465d91e69d2 ] + +As it turns out, there is a large number of out-of-tree DTSes (in +OpenWrt project) that used to specify incorrect (active high) polarity +for the Lantiq reset GPIO, so to keep compatibility while they are +being updated a quirk for force the polarity low is needed. Luckily +these old DTSes used nonstandard name for the property ("gpio-reset" vs +"reset-gpios") so the quirk will not hurt if there are any new devices +that need inverted polarity as they can specify the right polarity in +their DTS when using the standard "reset-gpios" property. + +Additionally the condition to enable the transition from standard to +non-standard reset GPIO property name was inverted and the replacement +name for the property was not correct. Fix this as well. + +Fixes: fbbbcd177a27 ("gpiolib: of: add quirk for locating reset lines with legacy bindings") +Fixes: 90c2d2eb7ab5 ("MIPS: pci: lantiq: switch to using gpiod API") +Reported-by: Martin Schiller +Acked-by: Martin Schiller +Signed-off-by: Dmitry Torokhov +Link: https://lore.kernel.org/r/ZoLpqv1PN08xHioh@google.com +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpiolib-of.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c +index d9525d95e818d..133d2a4c31a6d 100644 +--- a/drivers/gpio/gpiolib-of.c ++++ b/drivers/gpio/gpiolib-of.c +@@ -192,6 +192,16 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, + */ + { "himax,hx8357", "gpios-reset", false }, + { "himax,hx8369", "gpios-reset", false }, ++#endif ++#if IS_ENABLED(CONFIG_PCI_LANTIQ) ++ /* ++ * According to the PCI specification, the RST# pin is an ++ * active-low signal. However, most of the device trees that ++ * have been widely used for a long time incorrectly describe ++ * reset GPIO as active-high, and were also using wrong name ++ * for the property. ++ */ ++ { "lantiq,pci-xway", "gpio-reset", false }, + #endif + }; + unsigned int i; +@@ -491,9 +501,9 @@ static struct gpio_desc *of_find_gpio_rename(struct device_node *np, + { "reset", "reset-n-io", "marvell,nfc-uart" }, + { "reset", "reset-n-io", "mrvl,nfc-uart" }, + #endif +-#if !IS_ENABLED(CONFIG_PCI_LANTIQ) ++#if IS_ENABLED(CONFIG_PCI_LANTIQ) + /* MIPS Lantiq PCI */ +- { "reset", "gpios-reset", "lantiq,pci-xway" }, ++ { "reset", "gpio-reset", "lantiq,pci-xway" }, + #endif + + /* +-- +2.43.0 + diff --git a/queue-6.6/inet_diag-initialize-pad-field-in-struct-inet_diag_r.patch b/queue-6.6/inet_diag-initialize-pad-field-in-struct-inet_diag_r.patch new file mode 100644 index 00000000000..6f94c39c6b0 --- /dev/null +++ b/queue-6.6/inet_diag-initialize-pad-field-in-struct-inet_diag_r.patch @@ -0,0 +1,117 @@ +From b13014e59f6d478ba26dad49ddd0934a9a07af28 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jul 2024 18:16:49 +0900 +Subject: inet_diag: Initialize pad field in struct inet_diag_req_v2 + +From: Shigeru Yoshida + +[ Upstream commit 61cf1c739f08190a4cbf047b9fbb192a94d87e3f ] + +KMSAN reported uninit-value access in raw_lookup() [1]. Diag for raw +sockets uses the pad field in struct inet_diag_req_v2 for the +underlying protocol. This field corresponds to the sdiag_raw_protocol +field in struct inet_diag_req_raw. + +inet_diag_get_exact_compat() converts inet_diag_req to +inet_diag_req_v2, but leaves the pad field uninitialized. So the issue +occurs when raw_lookup() accesses the sdiag_raw_protocol field. + +Fix this by initializing the pad field in +inet_diag_get_exact_compat(). Also, do the same fix in +inet_diag_dump_compat() to avoid the similar issue in the future. + +[1] +BUG: KMSAN: uninit-value in raw_lookup net/ipv4/raw_diag.c:49 [inline] +BUG: KMSAN: uninit-value in raw_sock_get+0x657/0x800 net/ipv4/raw_diag.c:71 + raw_lookup net/ipv4/raw_diag.c:49 [inline] + raw_sock_get+0x657/0x800 net/ipv4/raw_diag.c:71 + raw_diag_dump_one+0xa1/0x660 net/ipv4/raw_diag.c:99 + inet_diag_cmd_exact+0x7d9/0x980 + inet_diag_get_exact_compat net/ipv4/inet_diag.c:1404 [inline] + inet_diag_rcv_msg_compat+0x469/0x530 net/ipv4/inet_diag.c:1426 + sock_diag_rcv_msg+0x23d/0x740 net/core/sock_diag.c:282 + netlink_rcv_skb+0x537/0x670 net/netlink/af_netlink.c:2564 + sock_diag_rcv+0x35/0x40 net/core/sock_diag.c:297 + netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] + netlink_unicast+0xe74/0x1240 net/netlink/af_netlink.c:1361 + netlink_sendmsg+0x10c6/0x1260 net/netlink/af_netlink.c:1905 + sock_sendmsg_nosec net/socket.c:730 [inline] + __sock_sendmsg+0x332/0x3d0 net/socket.c:745 + ____sys_sendmsg+0x7f0/0xb70 net/socket.c:2585 + ___sys_sendmsg+0x271/0x3b0 net/socket.c:2639 + __sys_sendmsg net/socket.c:2668 [inline] + __do_sys_sendmsg net/socket.c:2677 [inline] + __se_sys_sendmsg net/socket.c:2675 [inline] + __x64_sys_sendmsg+0x27e/0x4a0 net/socket.c:2675 + x64_sys_call+0x135e/0x3ce0 arch/x86/include/generated/asm/syscalls_64.h:47 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xd9/0x1e0 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Uninit was stored to memory at: + raw_sock_get+0x650/0x800 net/ipv4/raw_diag.c:71 + raw_diag_dump_one+0xa1/0x660 net/ipv4/raw_diag.c:99 + inet_diag_cmd_exact+0x7d9/0x980 + inet_diag_get_exact_compat net/ipv4/inet_diag.c:1404 [inline] + inet_diag_rcv_msg_compat+0x469/0x530 net/ipv4/inet_diag.c:1426 + sock_diag_rcv_msg+0x23d/0x740 net/core/sock_diag.c:282 + netlink_rcv_skb+0x537/0x670 net/netlink/af_netlink.c:2564 + sock_diag_rcv+0x35/0x40 net/core/sock_diag.c:297 + netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] + netlink_unicast+0xe74/0x1240 net/netlink/af_netlink.c:1361 + netlink_sendmsg+0x10c6/0x1260 net/netlink/af_netlink.c:1905 + sock_sendmsg_nosec net/socket.c:730 [inline] + __sock_sendmsg+0x332/0x3d0 net/socket.c:745 + ____sys_sendmsg+0x7f0/0xb70 net/socket.c:2585 + ___sys_sendmsg+0x271/0x3b0 net/socket.c:2639 + __sys_sendmsg net/socket.c:2668 [inline] + __do_sys_sendmsg net/socket.c:2677 [inline] + __se_sys_sendmsg net/socket.c:2675 [inline] + __x64_sys_sendmsg+0x27e/0x4a0 net/socket.c:2675 + x64_sys_call+0x135e/0x3ce0 arch/x86/include/generated/asm/syscalls_64.h:47 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xd9/0x1e0 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Local variable req.i created at: + inet_diag_get_exact_compat net/ipv4/inet_diag.c:1396 [inline] + inet_diag_rcv_msg_compat+0x2a6/0x530 net/ipv4/inet_diag.c:1426 + sock_diag_rcv_msg+0x23d/0x740 net/core/sock_diag.c:282 + +CPU: 1 PID: 8888 Comm: syz-executor.6 Not tainted 6.10.0-rc4-00217-g35bb670d65fc #32 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014 + +Fixes: 432490f9d455 ("net: ip, diag -- Add diag interface for raw sockets") +Reported-by: syzkaller +Signed-off-by: Shigeru Yoshida +Reviewed-by: Eric Dumazet +Link: https://patch.msgid.link/20240703091649.111773-1-syoshida@redhat.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/ipv4/inet_diag.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c +index 132b10e23758b..87ecefea72398 100644 +--- a/net/ipv4/inet_diag.c ++++ b/net/ipv4/inet_diag.c +@@ -1281,6 +1281,7 @@ static int inet_diag_dump_compat(struct sk_buff *skb, + req.sdiag_family = AF_UNSPEC; /* compatibility */ + req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type); + req.idiag_ext = rc->idiag_ext; ++ req.pad = 0; + req.idiag_states = rc->idiag_states; + req.id = rc->id; + +@@ -1296,6 +1297,7 @@ static int inet_diag_get_exact_compat(struct sk_buff *in_skb, + req.sdiag_family = rc->idiag_family; + req.sdiag_protocol = inet_diag_type2proto(nlh->nlmsg_type); + req.idiag_ext = rc->idiag_ext; ++ req.pad = 0; + req.idiag_states = rc->idiag_states; + req.id = rc->id; + +-- +2.43.0 + diff --git a/queue-6.6/kvm-s390-fix-lpswey-handling.patch b/queue-6.6/kvm-s390-fix-lpswey-handling.patch new file mode 100644 index 00000000000..b60edd1583f --- /dev/null +++ b/queue-6.6/kvm-s390-fix-lpswey-handling.patch @@ -0,0 +1,130 @@ +From 3d21ee38534be22846c43dbd5a3a1e79af431982 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Jun 2024 18:35:47 +0200 +Subject: KVM: s390: fix LPSWEY handling + +From: Christian Borntraeger + +[ Upstream commit 4c6abb7f7b349f00c0f7ed5045bf67759c012892 ] + +in rare cases, e.g. for injecting a machine check we do intercept all +load PSW instructions via ICTL_LPSW. With facility 193 a new variant +LPSWEY was added. KVM needs to handle that as well. + +Fixes: a3efa8429266 ("KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196") +Reported-by: Marc Hartmayer +Reviewed-by: Sven Schnelle +Reviewed-by: Claudio Imbrenda +Signed-off-by: Christian Borntraeger +Message-ID: <20240628163547.2314-1-borntraeger@linux.ibm.com> +Signed-off-by: Sasha Levin +--- + arch/s390/include/asm/kvm_host.h | 1 + + arch/s390/kvm/kvm-s390.c | 1 + + arch/s390/kvm/kvm-s390.h | 15 +++++++++++++++ + arch/s390/kvm/priv.c | 32 ++++++++++++++++++++++++++++++++ + 4 files changed, 49 insertions(+) + +diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h +index 67a298b6cf6e9..b039881c277a7 100644 +--- a/arch/s390/include/asm/kvm_host.h ++++ b/arch/s390/include/asm/kvm_host.h +@@ -427,6 +427,7 @@ struct kvm_vcpu_stat { + u64 instruction_io_other; + u64 instruction_lpsw; + u64 instruction_lpswe; ++ u64 instruction_lpswey; + u64 instruction_pfmf; + u64 instruction_ptff; + u64 instruction_sck; +diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c +index 36f60c3dae292..348d030d2660c 100644 +--- a/arch/s390/kvm/kvm-s390.c ++++ b/arch/s390/kvm/kvm-s390.c +@@ -132,6 +132,7 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { + STATS_DESC_COUNTER(VCPU, instruction_io_other), + STATS_DESC_COUNTER(VCPU, instruction_lpsw), + STATS_DESC_COUNTER(VCPU, instruction_lpswe), ++ STATS_DESC_COUNTER(VCPU, instruction_lpswey), + STATS_DESC_COUNTER(VCPU, instruction_pfmf), + STATS_DESC_COUNTER(VCPU, instruction_ptff), + STATS_DESC_COUNTER(VCPU, instruction_sck), +diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h +index a7ea80cfa445e..a8a6246835831 100644 +--- a/arch/s390/kvm/kvm-s390.h ++++ b/arch/s390/kvm/kvm-s390.h +@@ -120,6 +120,21 @@ static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu, u8 *ar) + return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; + } + ++static inline u64 kvm_s390_get_base_disp_siy(struct kvm_vcpu *vcpu, u8 *ar) ++{ ++ u32 base1 = vcpu->arch.sie_block->ipb >> 28; ++ s64 disp1; ++ ++ /* The displacement is a 20bit _SIGNED_ value */ ++ disp1 = sign_extend64(((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) + ++ ((vcpu->arch.sie_block->ipb & 0xff00) << 4), 19); ++ ++ if (ar) ++ *ar = base1; ++ ++ return (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1; ++} ++ + static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, + u64 *address1, u64 *address2, + u8 *ar_b1, u8 *ar_b2) +diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c +index dc4cfa8795c08..e5b220e686b09 100644 +--- a/arch/s390/kvm/priv.c ++++ b/arch/s390/kvm/priv.c +@@ -793,6 +793,36 @@ static int handle_lpswe(struct kvm_vcpu *vcpu) + return 0; + } + ++static int handle_lpswey(struct kvm_vcpu *vcpu) ++{ ++ psw_t new_psw; ++ u64 addr; ++ int rc; ++ u8 ar; ++ ++ vcpu->stat.instruction_lpswey++; ++ ++ if (!test_kvm_facility(vcpu->kvm, 193)) ++ return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); ++ ++ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) ++ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); ++ ++ addr = kvm_s390_get_base_disp_siy(vcpu, &ar); ++ if (addr & 7) ++ return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); ++ ++ rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw)); ++ if (rc) ++ return kvm_s390_inject_prog_cond(vcpu, rc); ++ ++ vcpu->arch.sie_block->gpsw = new_psw; ++ if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) ++ return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); ++ ++ return 0; ++} ++ + static int handle_stidp(struct kvm_vcpu *vcpu) + { + u64 stidp_data = vcpu->kvm->arch.model.cpuid; +@@ -1458,6 +1488,8 @@ int kvm_s390_handle_eb(struct kvm_vcpu *vcpu) + case 0x61: + case 0x62: + return handle_ri(vcpu); ++ case 0x71: ++ return handle_lpswey(vcpu); + default: + return -EOPNOTSUPP; + } +-- +2.43.0 + diff --git a/queue-6.6/mac802154-fix-time-calculation-in-ieee802154_configu.patch b/queue-6.6/mac802154-fix-time-calculation-in-ieee802154_configu.patch new file mode 100644 index 00000000000..b533da94002 --- /dev/null +++ b/queue-6.6/mac802154-fix-time-calculation-in-ieee802154_configu.patch @@ -0,0 +1,62 @@ +From f535e1061ca0f000fc1a34f8ef10c2c99af10b5d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 May 2024 14:40:10 +0300 +Subject: mac802154: fix time calculation in ieee802154_configure_durations() + +From: Dmitry Antipov + +[ Upstream commit 07aa33988ad92fef79056f5ec30b9a0e4364b616 ] + +Since 'symbol_duration' of 'struct wpan_phy' is in nanoseconds but +'lifs_period' and 'sifs_period' are both in microseconds, fix time +calculation in 'ieee802154_configure_durations()' and use convenient +'NSEC_PER_USEC' in 'ieee802154_setup_wpan_phy_pib()' as well. +Compile tested only. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: 781830c800dd ("net: mac802154: Set durations automatically") +Signed-off-by: Dmitry Antipov +Acked-by: Miquel Raynal +Message-ID: <20240508114010.219527-1-dmantipov@yandex.ru> +Signed-off-by: Stefan Schmidt +Signed-off-by: Sasha Levin +--- + net/mac802154/main.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/net/mac802154/main.c b/net/mac802154/main.c +index 357ece67432b1..3054da2aa9580 100644 +--- a/net/mac802154/main.c ++++ b/net/mac802154/main.c +@@ -159,8 +159,10 @@ void ieee802154_configure_durations(struct wpan_phy *phy, + } + + phy->symbol_duration = duration; +- phy->lifs_period = (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_SEC; +- phy->sifs_period = (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_SEC; ++ phy->lifs_period = ++ (IEEE802154_LIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; ++ phy->sifs_period = ++ (IEEE802154_SIFS_PERIOD * phy->symbol_duration) / NSEC_PER_USEC; + } + EXPORT_SYMBOL(ieee802154_configure_durations); + +@@ -182,10 +184,10 @@ static void ieee802154_setup_wpan_phy_pib(struct wpan_phy *wpan_phy) + * Should be done when all drivers sets this value. + */ + +- wpan_phy->lifs_period = +- (IEEE802154_LIFS_PERIOD * wpan_phy->symbol_duration) / 1000; +- wpan_phy->sifs_period = +- (IEEE802154_SIFS_PERIOD * wpan_phy->symbol_duration) / 1000; ++ wpan_phy->lifs_period = (IEEE802154_LIFS_PERIOD * ++ wpan_phy->symbol_duration) / NSEC_PER_USEC; ++ wpan_phy->sifs_period = (IEEE802154_SIFS_PERIOD * ++ wpan_phy->symbol_duration) / NSEC_PER_USEC; + } + + int ieee802154_register_hw(struct ieee802154_hw *hw) +-- +2.43.0 + diff --git a/queue-6.6/mlxsw-core_linecards-fix-double-memory-deallocation-.patch b/queue-6.6/mlxsw-core_linecards-fix-double-memory-deallocation-.patch new file mode 100644 index 00000000000..169e58fea51 --- /dev/null +++ b/queue-6.6/mlxsw-core_linecards-fix-double-memory-deallocation-.patch @@ -0,0 +1,46 @@ +From 65f06220e8afc58bb5acda72bc9eca4439a80771 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 Jul 2024 23:32:51 +0300 +Subject: mlxsw: core_linecards: Fix double memory deallocation in case of + invalid INI file + +From: Aleksandr Mishin + +[ Upstream commit 8ce34dccbe8fa7d2ef86f2d8e7db2a9b67cabfc3 ] + +In case of invalid INI file mlxsw_linecard_types_init() deallocates memory +but doesn't reset pointer to NULL and returns 0. In case of any error +occurred after mlxsw_linecard_types_init() call, mlxsw_linecards_init() +calls mlxsw_linecard_types_fini() which performs memory deallocation again. + +Add pointer reset to NULL. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: b217127e5e4e ("mlxsw: core_linecards: Add line card objects and implement provisioning") +Signed-off-by: Aleksandr Mishin +Reviewed-by: Przemek Kitszel +Reviewed-by: Ido Schimmel +Reviewed-by: Michal Kubiak +Link: https://patch.msgid.link/20240703203251.8871-1-amishin@t-argos.ru +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/mellanox/mlxsw/core_linecards.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c +index 025e0db983feb..b032d5a4b3b84 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c +@@ -1484,6 +1484,7 @@ static int mlxsw_linecard_types_init(struct mlxsw_core *mlxsw_core, + vfree(types_info->data); + err_data_alloc: + kfree(types_info); ++ linecards->types_info = NULL; + return err; + } + +-- +2.43.0 + diff --git a/queue-6.6/net-allow-skb_datagram_iter-to-be-called-from-any-co.patch b/queue-6.6/net-allow-skb_datagram_iter-to-be-called-from-any-co.patch new file mode 100644 index 00000000000..5affb09baa9 --- /dev/null +++ b/queue-6.6/net-allow-skb_datagram_iter-to-be-called-from-any-co.patch @@ -0,0 +1,60 @@ +From 3b040149f472cb3a4b5c68fb309ed2b269e9955f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jun 2024 13:00:08 +0300 +Subject: net: allow skb_datagram_iter to be called from any context + +From: Sagi Grimberg + +[ Upstream commit d2d30a376d9cc94c6fb730c58b3e5b7426ecb6de ] + +We only use the mapping in a single context, so kmap_local is sufficient +and cheaper. Make sure to use skb_frag_foreach_page as skb frags may +contain compound pages and we need to map page by page. + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-lkp/202406161539.b5ff7b20-oliver.sang@intel.com +Fixes: 950fcaecd5cc ("datagram: consolidate datagram copy to iter helpers") +Signed-off-by: Sagi Grimberg +Link: https://patch.msgid.link/20240626100008.831849-1-sagi@grimberg.me +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/core/datagram.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/net/core/datagram.c b/net/core/datagram.c +index 176eb58347461..e49aaf2d48b80 100644 +--- a/net/core/datagram.c ++++ b/net/core/datagram.c +@@ -434,15 +434,22 @@ static int __skb_datagram_iter(const struct sk_buff *skb, int offset, + + end = start + skb_frag_size(frag); + if ((copy = end - offset) > 0) { +- struct page *page = skb_frag_page(frag); +- u8 *vaddr = kmap(page); ++ u32 p_off, p_len, copied; ++ struct page *p; ++ u8 *vaddr; + + if (copy > len) + copy = len; +- n = INDIRECT_CALL_1(cb, simple_copy_to_iter, +- vaddr + skb_frag_off(frag) + offset - start, +- copy, data, to); +- kunmap(page); ++ ++ skb_frag_foreach_page(frag, ++ skb_frag_off(frag) + offset - start, ++ copy, p, p_off, p_len, copied) { ++ vaddr = kmap_local_page(p); ++ n = INDIRECT_CALL_1(cb, simple_copy_to_iter, ++ vaddr + p_off, p_len, data, to); ++ kunmap_local(vaddr); ++ } ++ + offset += n; + if (n != copy) + goto short_copy; +-- +2.43.0 + diff --git a/queue-6.6/net-mlx5-e-switch-create-ingress-acl-when-needed.patch b/queue-6.6/net-mlx5-e-switch-create-ingress-acl-when-needed.patch new file mode 100644 index 00000000000..71e5d49a6ea --- /dev/null +++ b/queue-6.6/net-mlx5-e-switch-create-ingress-acl-when-needed.patch @@ -0,0 +1,122 @@ +From 89e0be765d7b771a9f194afcbe7ce212db660d10 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 21:02:37 +0300 +Subject: net/mlx5: E-switch, Create ingress ACL when needed + +From: Chris Mi + +[ Upstream commit b20c2fb45470d0c7a603613c9cfa5d45720e17f2 ] + +Currently, ingress acl is used for three features. It is created only +when vport metadata match and prio tag are enabled. But active-backup +lag mode also uses it. It is independent of vport metadata match and +prio tag. And vport metadata match can be disabled using the +following devlink command: + + # devlink dev param set pci/0000:08:00.0 name esw_port_metadata \ + value false cmode runtime + +If ingress acl is not created, will hit panic when creating drop rule +for active-backup lag mode. If always create it, there will be about +5% performance degradation. + +Fix it by creating ingress acl when needed. If esw_port_metadata is +true, ingress acl exists, then create drop rule using existing +ingress acl. If esw_port_metadata is false, create ingress acl and +then create drop rule. + +Fixes: 1749c4c51c16 ("net/mlx5: E-switch, add drop rule support to ingress ACL") +Signed-off-by: Chris Mi +Signed-off-by: Tariq Toukan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../mellanox/mlx5/core/esw/acl/ingress_ofld.c | 37 +++++++++++++++---- + 1 file changed, 29 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +index 50d2ea3239798..a436ce895e45a 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c +@@ -6,6 +6,9 @@ + #include "helper.h" + #include "ofld.h" + ++static int ++acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport); ++ + static bool + esw_acl_ingress_prio_tag_enabled(struct mlx5_eswitch *esw, + const struct mlx5_vport *vport) +@@ -123,18 +126,31 @@ static int esw_acl_ingress_src_port_drop_create(struct mlx5_eswitch *esw, + { + struct mlx5_flow_act flow_act = {}; + struct mlx5_flow_handle *flow_rule; ++ bool created = false; + int err = 0; + ++ if (!vport->ingress.acl) { ++ err = acl_ingress_ofld_setup(esw, vport); ++ if (err) ++ return err; ++ created = true; ++ } ++ + flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP; + flow_act.fg = vport->ingress.offloads.drop_grp; + flow_rule = mlx5_add_flow_rules(vport->ingress.acl, NULL, &flow_act, NULL, 0); + if (IS_ERR(flow_rule)) { + err = PTR_ERR(flow_rule); +- goto out; ++ goto err_out; + } + + vport->ingress.offloads.drop_rule = flow_rule; +-out: ++ ++ return 0; ++err_out: ++ /* Only destroy ingress acl created in this function. */ ++ if (created) ++ esw_acl_ingress_ofld_cleanup(esw, vport); + return err; + } + +@@ -299,16 +315,12 @@ static void esw_acl_ingress_ofld_groups_destroy(struct mlx5_vport *vport) + } + } + +-int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, +- struct mlx5_vport *vport) ++static int ++acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) + { + int num_ftes = 0; + int err; + +- if (!mlx5_eswitch_vport_match_metadata_enabled(esw) && +- !esw_acl_ingress_prio_tag_enabled(esw, vport)) +- return 0; +- + esw_acl_ingress_allow_rule_destroy(vport); + + if (mlx5_eswitch_vport_match_metadata_enabled(esw)) +@@ -347,6 +359,15 @@ int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, + return err; + } + ++int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport) ++{ ++ if (!mlx5_eswitch_vport_match_metadata_enabled(esw) && ++ !esw_acl_ingress_prio_tag_enabled(esw, vport)) ++ return 0; ++ ++ return acl_ingress_ofld_setup(esw, vport); ++} ++ + void esw_acl_ingress_ofld_cleanup(struct mlx5_eswitch *esw, + struct mlx5_vport *vport) + { +-- +2.43.0 + diff --git a/queue-6.6/net-mlx5e-add-mqprio_rl-cleanup-and-free-in-mlx5e_pr.patch b/queue-6.6/net-mlx5e-add-mqprio_rl-cleanup-and-free-in-mlx5e_pr.patch new file mode 100644 index 00000000000..74a030ccd95 --- /dev/null +++ b/queue-6.6/net-mlx5e-add-mqprio_rl-cleanup-and-free-in-mlx5e_pr.patch @@ -0,0 +1,43 @@ +From c2975db9eea0202bc3ac04c7003be4ec5356e94c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 21:02:38 +0300 +Subject: net/mlx5e: Add mqprio_rl cleanup and free in mlx5e_priv_cleanup() + +From: Jianbo Liu + +[ Upstream commit 1da839eab6dbc26b95bfcd1ed1a4d1aaa5c144a3 ] + +In the cited commit, mqprio_rl cleanup and free are mistakenly removed +in mlx5e_priv_cleanup(), and it causes the leakage of host memory and +firmware SCHEDULING_ELEMENT objects while changing eswitch mode. So, +add them back. + +Fixes: 0bb7228f7096 ("net/mlx5e: Fix mqprio_rl handling on devlink reload") +Signed-off-by: Jianbo Liu +Reviewed-by: Dragos Tatulea +Signed-off-by: Tariq Toukan +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +index e87a776ea2bfd..a65c407aa60bd 100644 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +@@ -5700,6 +5700,11 @@ void mlx5e_priv_cleanup(struct mlx5e_priv *priv) + kfree(priv->htb_qos_sq_stats[i]); + kvfree(priv->htb_qos_sq_stats); + ++ if (priv->mqprio_rl) { ++ mlx5e_mqprio_rl_cleanup(priv->mqprio_rl); ++ mlx5e_mqprio_rl_free(priv->mqprio_rl); ++ } ++ + memset(priv, 0, sizeof(*priv)); + } + +-- +2.43.0 + diff --git a/queue-6.6/net-ntb_netdev-move-ntb_netdev_rx_handler-to-call-ne.patch b/queue-6.6/net-ntb_netdev-move-ntb_netdev_rx_handler-to-call-ne.patch new file mode 100644 index 00000000000..73a1c6c4003 --- /dev/null +++ b/queue-6.6/net-ntb_netdev-move-ntb_netdev_rx_handler-to-call-ne.patch @@ -0,0 +1,79 @@ +From 27803d60926d57d86025c503a90b75bcceb54974 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jul 2024 11:15:38 -0700 +Subject: net: ntb_netdev: Move ntb_netdev_rx_handler() to call netif_rx() from + __netif_rx() + +From: Dave Jiang + +[ Upstream commit e15a5d821e5192a3769d846079bc9aa380139baf ] + +The following is emitted when using idxd (DSA) dmanegine as the data +mover for ntb_transport that ntb_netdev uses. + +[74412.546922] BUG: using smp_processor_id() in preemptible [00000000] code: irq/52-idxd-por/14526 +[74412.556784] caller is netif_rx_internal+0x42/0x130 +[74412.562282] CPU: 6 PID: 14526 Comm: irq/52-idxd-por Not tainted 6.9.5 #5 +[74412.569870] Hardware name: Intel Corporation ArcherCity/ArcherCity, BIOS EGSDCRB1.E9I.1752.P05.2402080856 02/08/2024 +[74412.581699] Call Trace: +[74412.584514] +[74412.586933] dump_stack_lvl+0x55/0x70 +[74412.591129] check_preemption_disabled+0xc8/0xf0 +[74412.596374] netif_rx_internal+0x42/0x130 +[74412.600957] __netif_rx+0x20/0xd0 +[74412.604743] ntb_netdev_rx_handler+0x66/0x150 [ntb_netdev] +[74412.610985] ntb_complete_rxc+0xed/0x140 [ntb_transport] +[74412.617010] ntb_rx_copy_callback+0x53/0x80 [ntb_transport] +[74412.623332] idxd_dma_complete_txd+0xe3/0x160 [idxd] +[74412.628963] idxd_wq_thread+0x1a6/0x2b0 [idxd] +[74412.634046] irq_thread_fn+0x21/0x60 +[74412.638134] ? irq_thread+0xa8/0x290 +[74412.642218] irq_thread+0x1a0/0x290 +[74412.646212] ? __pfx_irq_thread_fn+0x10/0x10 +[74412.651071] ? __pfx_irq_thread_dtor+0x10/0x10 +[74412.656117] ? __pfx_irq_thread+0x10/0x10 +[74412.660686] kthread+0x100/0x130 +[74412.664384] ? __pfx_kthread+0x10/0x10 +[74412.668639] ret_from_fork+0x31/0x50 +[74412.672716] ? __pfx_kthread+0x10/0x10 +[74412.676978] ret_from_fork_asm+0x1a/0x30 +[74412.681457] + +The cause is due to the idxd driver interrupt completion handler uses +threaded interrupt and the threaded handler is not hard or soft interrupt +context. However __netif_rx() can only be called from interrupt context. +Change the call to netif_rx() in order to allow completion via normal +context for dmaengine drivers that utilize threaded irq handling. + +While the following commit changed from netif_rx() to __netif_rx(), +baebdf48c360 ("net: dev: Makes sure netif_rx() can be invoked in any context."), +the change should've been a noop instead. However, the code precedes this +fix should've been using netif_rx_ni() or netif_rx_any_context(). + +Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device") +Reported-by: Jerry Dai +Tested-by: Jerry Dai +Signed-off-by: Dave Jiang +Link: https://patch.msgid.link/20240701181538.3799546-1-dave.jiang@intel.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ntb_netdev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c +index 536bd6564f8b8..dade51cf599c6 100644 +--- a/drivers/net/ntb_netdev.c ++++ b/drivers/net/ntb_netdev.c +@@ -119,7 +119,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, + skb->protocol = eth_type_trans(skb, ndev); + skb->ip_summed = CHECKSUM_NONE; + +- if (__netif_rx(skb) == NET_RX_DROP) { ++ if (netif_rx(skb) == NET_RX_DROP) { + ndev->stats.rx_errors++; + ndev->stats.rx_dropped++; + } else { +-- +2.43.0 + diff --git a/queue-6.6/net-phy-phy_device-fix-phy-led-blinking-code-comment.patch b/queue-6.6/net-phy-phy_device-fix-phy-led-blinking-code-comment.patch new file mode 100644 index 00000000000..570433ca980 --- /dev/null +++ b/queue-6.6/net-phy-phy_device-fix-phy-led-blinking-code-comment.patch @@ -0,0 +1,40 @@ +From 135d8b85d0d5af75585a143192396941e24cb905 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jun 2024 05:06:17 +0200 +Subject: net: phy: phy_device: Fix PHY LED blinking code comment + +From: Marek Vasut + +[ Upstream commit d3dcb084c70727be4a2f61bd94796e66147cfa35 ] + +Fix copy-paste error in the code comment. The code refers to +LED blinking configuration, not brightness configuration. It +was likely copied from comment above this one which does +refer to brightness configuration. + +Fixes: 4e901018432e ("net: phy: phy_device: Call into the PHY driver to set LED blinking") +Signed-off-by: Marek Vasut +Reviewed-by: Andrew Lunn +Link: https://patch.msgid.link/20240626030638.512069-1-marex@denx.de +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + include/linux/phy.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/phy.h b/include/linux/phy.h +index 1351b802ffcff..5aa30ee998104 100644 +--- a/include/linux/phy.h ++++ b/include/linux/phy.h +@@ -1099,7 +1099,7 @@ struct phy_driver { + u8 index, enum led_brightness value); + + /** +- * @led_blink_set: Set a PHY LED brightness. Index indicates ++ * @led_blink_set: Set a PHY LED blinking. Index indicates + * which of the PHYs led should be configured to blink. Delays + * are in milliseconds and if both are zero then a sensible + * default should be chosen. The call should adjust the +-- +2.43.0 + diff --git a/queue-6.6/net-txgbe-initialize-num_q_vectors-for-msi-intx-inte.patch b/queue-6.6/net-txgbe-initialize-num_q_vectors-for-msi-intx-inte.patch new file mode 100644 index 00000000000..d625065a512 --- /dev/null +++ b/queue-6.6/net-txgbe-initialize-num_q_vectors-for-msi-intx-inte.patch @@ -0,0 +1,36 @@ +From 7e366ed000cfb71986d04efd4c43b71afcd81297 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jul 2024 15:14:13 +0800 +Subject: net: txgbe: initialize num_q_vectors for MSI/INTx interrupts + +From: Jiawen Wu + +[ Upstream commit 7c36711a2cd8059c2d24f5e5c1d76e8ea2d5613c ] + +When using MSI/INTx interrupts, wx->num_q_vectors is uninitialized. +Thus there will be kernel panic in wx_alloc_q_vectors() to allocate +queue vectors. + +Fixes: 3f703186113f ("net: libwx: Add irq flow functions") +Signed-off-by: Jiawen Wu +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/wangxun/libwx/wx_lib.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/wangxun/libwx/wx_lib.c b/drivers/net/ethernet/wangxun/libwx/wx_lib.c +index e9310d9ca67c9..bba44ff0e2872 100644 +--- a/drivers/net/ethernet/wangxun/libwx/wx_lib.c ++++ b/drivers/net/ethernet/wangxun/libwx/wx_lib.c +@@ -1657,6 +1657,7 @@ static int wx_set_interrupt_capability(struct wx *wx) + } + + pdev->irq = pci_irq_vector(pdev, 0); ++ wx->num_q_vectors = 1; + + return 0; + } +-- +2.43.0 + diff --git a/queue-6.6/netfilter-nf_tables-unconditionally-flush-pending-wo.patch b/queue-6.6/netfilter-nf_tables-unconditionally-flush-pending-wo.patch new file mode 100644 index 00000000000..5f9f382ae5f --- /dev/null +++ b/queue-6.6/netfilter-nf_tables-unconditionally-flush-pending-wo.patch @@ -0,0 +1,62 @@ +From b7102c7307e27997bef4cb299883d07c67baf6a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jul 2024 16:08:14 +0200 +Subject: netfilter: nf_tables: unconditionally flush pending work before + notifier + +From: Florian Westphal + +[ Upstream commit 9f6958ba2e902f9820c594869bd710ba74b7c4c0 ] + +syzbot reports: + +KASAN: slab-uaf in nft_ctx_update include/net/netfilter/nf_tables.h:1831 +KASAN: slab-uaf in nft_commit_release net/netfilter/nf_tables_api.c:9530 +KASAN: slab-uaf int nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597 +Read of size 2 at addr ffff88802b0051c4 by task kworker/1:1/45 +[..] +Workqueue: events nf_tables_trans_destroy_work +Call Trace: + nft_ctx_update include/net/netfilter/nf_tables.h:1831 [inline] + nft_commit_release net/netfilter/nf_tables_api.c:9530 [inline] + nf_tables_trans_destroy_work+0x152b/0x1750 net/netfilter/nf_tables_api.c:9597 + +Problem is that the notifier does a conditional flush, but its possible +that the table-to-be-removed is still referenced by transactions being +processed by the worker, so we need to flush unconditionally. + +We could make the flush_work depend on whether we found a table to delete +in nf-next to avoid the flush for most cases. + +AFAICS this problem is only exposed in nf-next, with +commit e169285f8c56 ("netfilter: nf_tables: do not store nft_ctx in transaction objects"), +with this commit applied there is an unconditional fetch of +table->family which is whats triggering the above splat. + +Fixes: 2c9f0293280e ("netfilter: nf_tables: flush pending destroy work before netlink notifier") +Reported-and-tested-by: syzbot+4fd66a69358fc15ae2ad@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=4fd66a69358fc15ae2ad +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nf_tables_api.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 7547f7b869395..dd044a47c8723 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -11291,8 +11291,7 @@ static int nft_rcv_nl_event(struct notifier_block *this, unsigned long event, + + gc_seq = nft_gc_seq_begin(nft_net); + +- if (!list_empty(&nf_tables_destroy_list)) +- nf_tables_trans_destroy_flush_work(); ++ nf_tables_trans_destroy_flush_work(); + again: + list_for_each_entry(table, &nft_net->tables, list) { + if (nft_table_has_owner(table) && +-- +2.43.0 + diff --git a/queue-6.6/riscv-kexec-avoid-deadlock-in-kexec-crash-path.patch b/queue-6.6/riscv-kexec-avoid-deadlock-in-kexec-crash-path.patch new file mode 100644 index 00000000000..b286d30f89d --- /dev/null +++ b/queue-6.6/riscv-kexec-avoid-deadlock-in-kexec-crash-path.patch @@ -0,0 +1,58 @@ +From ae4566b0e3a5e7470b1ab3f71a9864feb8047a07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jun 2024 10:33:16 +0800 +Subject: riscv: kexec: Avoid deadlock in kexec crash path + +From: Song Shuai + +[ Upstream commit c562ba719df570c986caf0941fea2449150bcbc4 ] + +If the kexec crash code is called in the interrupt context, the +machine_kexec_mask_interrupts() function will trigger a deadlock while +trying to acquire the irqdesc spinlock and then deactivate irqchip in +irq_set_irqchip_state() function. + +Unlike arm64, riscv only requires irq_eoi handler to complete EOI and +keeping irq_set_irqchip_state() will only leave this possible deadlock +without any use. So we simply remove it. + +Link: https://lore.kernel.org/linux-riscv/20231208111015.173237-1-songshuaishuai@tinylab.org/ +Fixes: b17d19a5314a ("riscv: kexec: Fixup irq controller broken in kexec crash path") +Signed-off-by: Song Shuai +Reviewed-by: Ryo Takakura +Link: https://lore.kernel.org/r/20240626023316.539971-1-songshuaishuai@tinylab.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/kernel/machine_kexec.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/arch/riscv/kernel/machine_kexec.c b/arch/riscv/kernel/machine_kexec.c +index 2d139b724bc84..ccb0c5d5c63c4 100644 +--- a/arch/riscv/kernel/machine_kexec.c ++++ b/arch/riscv/kernel/machine_kexec.c +@@ -147,20 +147,12 @@ static void machine_kexec_mask_interrupts(void) + + for_each_irq_desc(i, desc) { + struct irq_chip *chip; +- int ret; + + chip = irq_desc_get_chip(desc); + if (!chip) + continue; + +- /* +- * First try to remove the active state. If this +- * fails, try to EOI the interrupt. +- */ +- ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false); +- +- if (ret && irqd_irq_inprogress(&desc->irq_data) && +- chip->irq_eoi) ++ if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data)) + chip->irq_eoi(&desc->irq_data); + + if (chip->irq_mask) +-- +2.43.0 + diff --git a/queue-6.6/selftests-fix-oom-in-msg_zerocopy-selftest.patch b/queue-6.6/selftests-fix-oom-in-msg_zerocopy-selftest.patch new file mode 100644 index 00000000000..247b55c1a58 --- /dev/null +++ b/queue-6.6/selftests-fix-oom-in-msg_zerocopy-selftest.patch @@ -0,0 +1,101 @@ +From 417f5cfbc588db415a73d2bf83ecb49dc946f9e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jul 2024 22:53:48 +0000 +Subject: selftests: fix OOM in msg_zerocopy selftest + +From: Zijian Zhang + +[ Upstream commit af2b7e5b741aaae9ffbba2c660def434e07aa241 ] + +In selftests/net/msg_zerocopy.c, it has a while loop keeps calling sendmsg +on a socket with MSG_ZEROCOPY flag, and it will recv the notifications +until the socket is not writable. Typically, it will start the receiving +process after around 30+ sendmsgs. However, as the introduction of commit +dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale"), the sender is +always writable and does not get any chance to run recv notifications. +The selftest always exits with OUT_OF_MEMORY because the memory used by +opt_skb exceeds the net.core.optmem_max. Meanwhile, it could be set to a +different value to trigger OOM on older kernels too. + +Thus, we introduce "cfg_notification_limit" to force sender to receive +notifications after some number of sendmsgs. + +Fixes: 07b65c5b31ce ("test: add msg_zerocopy test") +Signed-off-by: Zijian Zhang +Signed-off-by: Xiaochun Lu +Reviewed-by: Willem de Bruijn +Link: https://patch.msgid.link/20240701225349.3395580-2-zijianzhang@bytedance.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/msg_zerocopy.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c +index bdc03a2097e85..926556febc83c 100644 +--- a/tools/testing/selftests/net/msg_zerocopy.c ++++ b/tools/testing/selftests/net/msg_zerocopy.c +@@ -85,6 +85,7 @@ static bool cfg_rx; + static int cfg_runtime_ms = 4200; + static int cfg_verbose; + static int cfg_waittime_ms = 500; ++static int cfg_notification_limit = 32; + static bool cfg_zerocopy; + + static socklen_t cfg_alen; +@@ -95,6 +96,7 @@ static char payload[IP_MAXPACKET]; + static long packets, bytes, completions, expected_completions; + static int zerocopied = -1; + static uint32_t next_completion; ++static uint32_t sends_since_notify; + + static unsigned long gettimeofday_ms(void) + { +@@ -208,6 +210,7 @@ static bool do_sendmsg(int fd, struct msghdr *msg, bool do_zerocopy, int domain) + error(1, errno, "send"); + if (cfg_verbose && ret != len) + fprintf(stderr, "send: ret=%u != %u\n", ret, len); ++ sends_since_notify++; + + if (len) { + packets++; +@@ -460,6 +463,7 @@ static bool do_recv_completion(int fd, int domain) + static void do_recv_completions(int fd, int domain) + { + while (do_recv_completion(fd, domain)) {} ++ sends_since_notify = 0; + } + + /* Wait for all remaining completions on the errqueue */ +@@ -549,6 +553,9 @@ static void do_tx(int domain, int type, int protocol) + else + do_sendmsg(fd, &msg, cfg_zerocopy, domain); + ++ if (cfg_zerocopy && sends_since_notify >= cfg_notification_limit) ++ do_recv_completions(fd, domain); ++ + while (!do_poll(fd, POLLOUT)) { + if (cfg_zerocopy) + do_recv_completions(fd, domain); +@@ -708,7 +715,7 @@ static void parse_opts(int argc, char **argv) + + cfg_payload_len = max_payload_len; + +- while ((c = getopt(argc, argv, "46c:C:D:i:mp:rs:S:t:vz")) != -1) { ++ while ((c = getopt(argc, argv, "46c:C:D:i:l:mp:rs:S:t:vz")) != -1) { + switch (c) { + case '4': + if (cfg_family != PF_UNSPEC) +@@ -736,6 +743,9 @@ static void parse_opts(int argc, char **argv) + if (cfg_ifindex == 0) + error(1, errno, "invalid iface: %s", optarg); + break; ++ case 'l': ++ cfg_notification_limit = strtoul(optarg, NULL, 0); ++ break; + case 'm': + cfg_cork_mixed = true; + break; +-- +2.43.0 + diff --git a/queue-6.6/selftests-make-order-checking-verbose-in-msg_zerocop.patch b/queue-6.6/selftests-make-order-checking-verbose-in-msg_zerocop.patch new file mode 100644 index 00000000000..15efaa8642b --- /dev/null +++ b/queue-6.6/selftests-make-order-checking-verbose-in-msg_zerocop.patch @@ -0,0 +1,40 @@ +From ec74bd083797cb8b60c005ec7457920f4d74e165 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jul 2024 22:53:49 +0000 +Subject: selftests: make order checking verbose in msg_zerocopy selftest + +From: Zijian Zhang + +[ Upstream commit 7d6d8f0c8b700c9493f2839abccb6d29028b4219 ] + +We find that when lock debugging is on, notifications may not come in +order. Thus, we have order checking outputs managed by cfg_verbose, to +avoid too many outputs in this case. + +Fixes: 07b65c5b31ce ("test: add msg_zerocopy test") +Signed-off-by: Zijian Zhang +Signed-off-by: Xiaochun Lu +Reviewed-by: Willem de Bruijn +Link: https://patch.msgid.link/20240701225349.3395580-3-zijianzhang@bytedance.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/msg_zerocopy.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c +index 926556febc83c..7ea5fb28c93db 100644 +--- a/tools/testing/selftests/net/msg_zerocopy.c ++++ b/tools/testing/selftests/net/msg_zerocopy.c +@@ -438,7 +438,7 @@ static bool do_recv_completion(int fd, int domain) + /* Detect notification gaps. These should not happen often, if at all. + * Gaps can occur due to drops, reordering and retransmissions. + */ +- if (lo != next_completion) ++ if (cfg_verbose && lo != next_completion) + fprintf(stderr, "gap: %u..%u does not append to %u\n", + lo, hi, next_completion); + next_completion = hi + 1; +-- +2.43.0 + diff --git a/queue-6.6/series b/queue-6.6/series index f0d70b831c0..153afe50767 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -58,3 +58,30 @@ tools-power-turbostat-remember-global-max_die_id.patch vhost-use-virtqueue-mutex-for-swapping-worker.patch vhost-release-worker-mutex-during-flushes.patch vhost_task-handle-sigkill-by-flushing-work-and-exiti.patch +mac802154-fix-time-calculation-in-ieee802154_configu.patch +wifi-cfg80211-restrict-nl80211_attr_txq_quantum-valu.patch +net-phy-phy_device-fix-phy-led-blinking-code-comment.patch +upstream-tcp-fix-dsack-undo-in-fast-recovery-to-call.patch +net-mlx5-e-switch-create-ingress-acl-when-needed.patch +net-mlx5e-add-mqprio_rl-cleanup-and-free-in-mlx5e_pr.patch +bluetooth-hci_event-fix-setting-of-unicast-qos-inter.patch +bluetooth-ignore-too-large-handle-values-in-big.patch +bluetooth-iso-check-socket-flag-instead-of-hcon.patch +bluetooth-hci-disallow-setting-handle-bigger-than-hc.patch +tcp_metrics-validate-source-addr-length.patch +kvm-s390-fix-lpswey-handling.patch +e1000e-fix-s0ix-residency-on-corporate-systems.patch +gpiolib-of-fix-lookup-quirk-for-mips-lantiq.patch +net-allow-skb_datagram_iter-to-be-called-from-any-co.patch +net-txgbe-initialize-num_q_vectors-for-msi-intx-inte.patch +net-ntb_netdev-move-ntb_netdev_rx_handler-to-call-ne.patch +gpio-mmio-do-not-calculate-bgpio_bits-via-ngpios.patch +wifi-wilc1000-fix-ies_len-type-in-connect-path.patch +riscv-kexec-avoid-deadlock-in-kexec-crash-path.patch +netfilter-nf_tables-unconditionally-flush-pending-wo.patch +bonding-fix-out-of-bounds-read-in-bond_option_arp_ip.patch +selftests-fix-oom-in-msg_zerocopy-selftest.patch +selftests-make-order-checking-verbose-in-msg_zerocop.patch +inet_diag-initialize-pad-field-in-struct-inet_diag_r.patch +mlxsw-core_linecards-fix-double-memory-deallocation-.patch +gpiolib-of-add-polarity-quirk-for-tsc2005.patch diff --git a/queue-6.6/tcp_metrics-validate-source-addr-length.patch b/queue-6.6/tcp_metrics-validate-source-addr-length.patch new file mode 100644 index 00000000000..0ccc725b408 --- /dev/null +++ b/queue-6.6/tcp_metrics-validate-source-addr-length.patch @@ -0,0 +1,38 @@ +From bbb49c73a2dea9c5e4badfd0ab36b0b78891ff40 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 14:25:00 -0700 +Subject: tcp_metrics: validate source addr length + +From: Jakub Kicinski + +[ Upstream commit 66be40e622e177316ae81717aa30057ba9e61dff ] + +I don't see anything checking that TCP_METRICS_ATTR_SADDR_IPV4 +is at least 4 bytes long, and the policy doesn't have an entry +for this attribute at all (neither does it for IPv6 but v6 is +manually validated). + +Reviewed-by: Eric Dumazet +Fixes: 3e7013ddf55a ("tcp: metrics: Allow selective get/del of tcp-metrics based on src IP") +Signed-off-by: Jakub Kicinski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_metrics.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c +index 7aca12c59c184..b71f94a5932ac 100644 +--- a/net/ipv4/tcp_metrics.c ++++ b/net/ipv4/tcp_metrics.c +@@ -619,6 +619,7 @@ static const struct nla_policy tcp_metrics_nl_policy[TCP_METRICS_ATTR_MAX + 1] = + [TCP_METRICS_ATTR_ADDR_IPV4] = { .type = NLA_U32, }, + [TCP_METRICS_ATTR_ADDR_IPV6] = { .type = NLA_BINARY, + .len = sizeof(struct in6_addr), }, ++ [TCP_METRICS_ATTR_SADDR_IPV4] = { .type = NLA_U32, }, + /* Following attributes are not received for GET/DEL, + * we keep them for reference + */ +-- +2.43.0 + diff --git a/queue-6.6/upstream-tcp-fix-dsack-undo-in-fast-recovery-to-call.patch b/queue-6.6/upstream-tcp-fix-dsack-undo-in-fast-recovery-to-call.patch new file mode 100644 index 00000000000..58ac8684064 --- /dev/null +++ b/queue-6.6/upstream-tcp-fix-dsack-undo-in-fast-recovery-to-call.patch @@ -0,0 +1,70 @@ +From 2d7231380d4b569189331beed79bcc880238e95f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jun 2024 22:42:27 -0400 +Subject: UPSTREAM: tcp: fix DSACK undo in fast recovery to call + tcp_try_to_open() + +From: Neal Cardwell + +[ Upstream commit a6458ab7fd4f427d4f6f54380453ad255b7fde83 ] + +In some production workloads we noticed that connections could +sometimes close extremely prematurely with ETIMEDOUT after +transmitting only 1 TLP and RTO retransmission (when we would normally +expect roughly tcp_retries2 = TCP_RETR2 = 15 RTOs before a connection +closes with ETIMEDOUT). + +From tracing we determined that these workloads can suffer from a +scenario where in fast recovery, after some retransmits, a DSACK undo +can happen at a point where the scoreboard is totally clear (we have +retrans_out == sacked_out == lost_out == 0). In such cases, calling +tcp_try_keep_open() means that we do not execute any code path that +clears tp->retrans_stamp to 0. That means that tp->retrans_stamp can +remain erroneously set to the start time of the undone fast recovery, +even after the fast recovery is undone. If minutes or hours elapse, +and then a TLP/RTO/RTO sequence occurs, then the start_ts value in +retransmits_timed_out() (which is from tp->retrans_stamp) will be +erroneously ancient (left over from the fast recovery undone via +DSACKs). Thus this ancient tp->retrans_stamp value can cause the +connection to die very prematurely with ETIMEDOUT via +tcp_write_err(). + +The fix: we change DSACK undo in fast recovery (TCP_CA_Recovery) to +call tcp_try_to_open() instead of tcp_try_keep_open(). This ensures +that if no retransmits are in flight at the time of DSACK undo in fast +recovery then we properly zero retrans_stamp. Note that calling +tcp_try_to_open() is more consistent with other loss recovery +behavior, since normal fast recovery (CA_Recovery) and RTO recovery +(CA_Loss) both normally end when tp->snd_una meets or exceeds +tp->high_seq and then in tcp_fastretrans_alert() the "default" switch +case executes tcp_try_to_open(). Also note that by inspection this +change to call tcp_try_to_open() implies at least one other nice bug +fix, where now an ECE-marked DSACK that causes an undo will properly +invoke tcp_enter_cwr() rather than ignoring the ECE mark. + +Fixes: c7d9d6a185a7 ("tcp: undo on DSACK during recovery") +Signed-off-by: Neal Cardwell +Signed-off-by: Yuchung Cheng +Signed-off-by: Eric Dumazet +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_input.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 6743b6bfbc9c5..2621c262f182a 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -3046,7 +3046,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, + return; + + if (tcp_try_undo_dsack(sk)) +- tcp_try_keep_open(sk); ++ tcp_try_to_open(sk, flag); + + tcp_identify_packet_loss(sk, ack_flag); + if (icsk->icsk_ca_state != TCP_CA_Recovery) { +-- +2.43.0 + diff --git a/queue-6.6/wifi-cfg80211-restrict-nl80211_attr_txq_quantum-valu.patch b/queue-6.6/wifi-cfg80211-restrict-nl80211_attr_txq_quantum-valu.patch new file mode 100644 index 00000000000..57fcb83bbd8 --- /dev/null +++ b/queue-6.6/wifi-cfg80211-restrict-nl80211_attr_txq_quantum-valu.patch @@ -0,0 +1,123 @@ +From 0014eb2dd000fba5b30a3cb883b750bd344f050d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 Jun 2024 16:08:00 +0000 +Subject: wifi: cfg80211: restrict NL80211_ATTR_TXQ_QUANTUM values + +From: Eric Dumazet + +[ Upstream commit d1cba2ea8121e7fdbe1328cea782876b1dd80993 ] + +syzbot is able to trigger softlockups, setting NL80211_ATTR_TXQ_QUANTUM +to 2^31. + +We had a similar issue in sch_fq, fixed with commit +d9e15a273306 ("pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM") + +watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [kworker/1:0:24] +Modules linked in: +irq event stamp: 131135 + hardirqs last enabled at (131134): [] __exit_to_kernel_mode arch/arm64/kernel/entry-common.c:85 [inline] + hardirqs last enabled at (131134): [] exit_to_kernel_mode+0xdc/0x10c arch/arm64/kernel/entry-common.c:95 + hardirqs last disabled at (131135): [] __el1_irq arch/arm64/kernel/entry-common.c:533 [inline] + hardirqs last disabled at (131135): [] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:551 + softirqs last enabled at (125892): [] neigh_hh_init net/core/neighbour.c:1538 [inline] + softirqs last enabled at (125892): [] neigh_resolve_output+0x268/0x658 net/core/neighbour.c:1553 + softirqs last disabled at (125896): [] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19 +CPU: 1 PID: 24 Comm: kworker/1:0 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 +Workqueue: mld mld_ifc_work +pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) + pc : __list_del include/linux/list.h:195 [inline] + pc : __list_del_entry include/linux/list.h:218 [inline] + pc : list_move_tail include/linux/list.h:310 [inline] + pc : fq_tin_dequeue include/net/fq_impl.h:112 [inline] + pc : ieee80211_tx_dequeue+0x6b8/0x3b4c net/mac80211/tx.c:3854 + lr : __list_del_entry include/linux/list.h:218 [inline] + lr : list_move_tail include/linux/list.h:310 [inline] + lr : fq_tin_dequeue include/net/fq_impl.h:112 [inline] + lr : ieee80211_tx_dequeue+0x67c/0x3b4c net/mac80211/tx.c:3854 +sp : ffff800093d36700 +x29: ffff800093d36a60 x28: ffff800093d36960 x27: dfff800000000000 +x26: ffff0000d800ad50 x25: ffff0000d800abe0 x24: ffff0000d800abf0 +x23: ffff0000e0032468 x22: ffff0000e00324d4 x21: ffff0000d800abf0 +x20: ffff0000d800abf8 x19: ffff0000d800abf0 x18: ffff800093d363c0 +x17: 000000000000d476 x16: ffff8000805519dc x15: ffff7000127a6cc8 +x14: 1ffff000127a6cc8 x13: 0000000000000004 x12: ffffffffffffffff +x11: ffff7000127a6cc8 x10: 0000000000ff0100 x9 : 0000000000000000 +x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 +x5 : ffff80009287aa08 x4 : 0000000000000008 x3 : ffff80008034c7fc +x2 : ffff0000e0032468 x1 : 00000000da0e46b8 x0 : ffff0000e0032470 +Call trace: + __list_del include/linux/list.h:195 [inline] + __list_del_entry include/linux/list.h:218 [inline] + list_move_tail include/linux/list.h:310 [inline] + fq_tin_dequeue include/net/fq_impl.h:112 [inline] + ieee80211_tx_dequeue+0x6b8/0x3b4c net/mac80211/tx.c:3854 + wake_tx_push_queue net/mac80211/util.c:294 [inline] + ieee80211_handle_wake_tx_queue+0x118/0x274 net/mac80211/util.c:315 + drv_wake_tx_queue net/mac80211/driver-ops.h:1350 [inline] + schedule_and_wake_txq net/mac80211/driver-ops.h:1357 [inline] + ieee80211_queue_skb+0x18e8/0x2244 net/mac80211/tx.c:1664 + ieee80211_tx+0x260/0x400 net/mac80211/tx.c:1966 + ieee80211_xmit+0x278/0x354 net/mac80211/tx.c:2062 + __ieee80211_subif_start_xmit+0xab8/0x122c net/mac80211/tx.c:4338 + ieee80211_subif_start_xmit+0xe0/0x438 net/mac80211/tx.c:4532 + __netdev_start_xmit include/linux/netdevice.h:4903 [inline] + netdev_start_xmit include/linux/netdevice.h:4917 [inline] + xmit_one net/core/dev.c:3531 [inline] + dev_hard_start_xmit+0x27c/0x938 net/core/dev.c:3547 + __dev_queue_xmit+0x1678/0x33fc net/core/dev.c:4341 + dev_queue_xmit include/linux/netdevice.h:3091 [inline] + neigh_resolve_output+0x558/0x658 net/core/neighbour.c:1563 + neigh_output include/net/neighbour.h:542 [inline] + ip6_finish_output2+0x104c/0x1ee8 net/ipv6/ip6_output.c:137 + ip6_finish_output+0x428/0x7a0 net/ipv6/ip6_output.c:222 + NF_HOOK_COND include/linux/netfilter.h:303 [inline] + ip6_output+0x270/0x594 net/ipv6/ip6_output.c:243 + dst_output include/net/dst.h:450 [inline] + NF_HOOK+0x160/0x4f0 include/linux/netfilter.h:314 + mld_sendpack+0x7b4/0x10f4 net/ipv6/mcast.c:1818 + mld_send_cr net/ipv6/mcast.c:2119 [inline] + mld_ifc_work+0x840/0xd0c net/ipv6/mcast.c:2650 + process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3267 + process_scheduled_works kernel/workqueue.c:3348 [inline] + worker_thread+0x938/0xef4 kernel/workqueue.c:3429 + kthread+0x288/0x310 kernel/kthread.c:388 + ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 + +Fixes: 52539ca89f36 ("cfg80211: Expose TXQ stats and parameters to userspace") +Signed-off-by: Eric Dumazet +Link: https://patch.msgid.link/20240615160800.250667-1-edumazet@google.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/nl80211.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index 8f8f077e6cd40..969983944ac16 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -468,6 +468,10 @@ static struct netlink_range_validation nl80211_punct_bitmap_range = { + .max = 0xffff, + }; + ++static const struct netlink_range_validation q_range = { ++ .max = INT_MAX, ++}; ++ + static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { + [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, + [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, +@@ -750,7 +754,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { + + [NL80211_ATTR_TXQ_LIMIT] = { .type = NLA_U32 }, + [NL80211_ATTR_TXQ_MEMORY_LIMIT] = { .type = NLA_U32 }, +- [NL80211_ATTR_TXQ_QUANTUM] = { .type = NLA_U32 }, ++ [NL80211_ATTR_TXQ_QUANTUM] = NLA_POLICY_FULL_RANGE(NLA_U32, &q_range), + [NL80211_ATTR_HE_CAPABILITY] = + NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_he_capa, + NL80211_HE_MAX_CAPABILITY_LEN), +-- +2.43.0 + diff --git a/queue-6.6/wifi-wilc1000-fix-ies_len-type-in-connect-path.patch b/queue-6.6/wifi-wilc1000-fix-ies_len-type-in-connect-path.patch new file mode 100644 index 00000000000..248b8b69c12 --- /dev/null +++ b/queue-6.6/wifi-wilc1000-fix-ies_len-type-in-connect-path.patch @@ -0,0 +1,51 @@ +From 42b382d9aba66f6f4c41773c53c4cc95735f0a2d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 Jul 2024 18:23:20 +0200 +Subject: wifi: wilc1000: fix ies_len type in connect path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jozef Hopko + +[ Upstream commit 39ab8fff623053a50951b659e5f6b72343d7d78c ] + +Commit 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path") +made sure that the IEs data was manipulated under the relevant RCU section. +Unfortunately, while doing so, the commit brought a faulty implicit cast +from int to u8 on the ies_len variable, making the parsing fail to be +performed correctly if the IEs block is larger than 255 bytes. This failure +can be observed with Access Points appending a lot of IEs TLVs in their +beacon frames (reproduced with a Pixel phone acting as an Access Point, +which brough 273 bytes of IE data in my testing environment). + +Fix IEs parsing by removing this undesired implicit cast. + +Fixes: 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path") +Signed-off-by: Jozef Hopko +Signed-off-by: Alexis Lothoré +Acked-by: Ajay Singh +Signed-off-by: Kalle Valo +Link: https://patch.msgid.link/20240701-wilc_fix_ies_data-v1-1-7486cbacf98a@bootlin.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/microchip/wilc1000/hif.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c +index e202013e6f2fe..e4bb3ea6e2267 100644 +--- a/drivers/net/wireless/microchip/wilc1000/hif.c ++++ b/drivers/net/wireless/microchip/wilc1000/hif.c +@@ -379,7 +379,8 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, + struct ieee80211_p2p_noa_attr noa_attr; + const struct cfg80211_bss_ies *ies; + struct wilc_join_bss_param *param; +- u8 rates_len = 0, ies_len; ++ u8 rates_len = 0; ++ int ies_len; + int ret; + + param = kzalloc(sizeof(*param), GFP_KERNEL); +-- +2.43.0 + -- 2.47.3