From: Greg Kroah-Hartman Date: Tue, 23 Jul 2024 14:02:20 +0000 (+0200) Subject: 6.6-stable patches X-Git-Tag: v6.10.1~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c8efe73284e5d94331cb7eb32eda49347439ac2;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: bluetooth-l2cap-fix-deadlock.patch of-irq-disable-interrupt-map-parsing-for-pasemi-nemo.patch wifi-cfg80211-wext-set-ssids-null-for-passive-scans.patch wifi-mac80211-disable-softirqs-for-queued-frame-handling.patch --- diff --git a/queue-6.6/bluetooth-l2cap-fix-deadlock.patch b/queue-6.6/bluetooth-l2cap-fix-deadlock.patch new file mode 100644 index 00000000000..6c043ab3b3b --- /dev/null +++ b/queue-6.6/bluetooth-l2cap-fix-deadlock.patch @@ -0,0 +1,258 @@ +From f1a8f402f13f94263cf349216c257b2985100927 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Mon, 24 Jun 2024 09:42:09 -0400 +Subject: Bluetooth: L2CAP: Fix deadlock + +From: Luiz Augusto von Dentz + +commit f1a8f402f13f94263cf349216c257b2985100927 upstream. + +This fixes the following deadlock introduced by 39a92a55be13 +("bluetooth/l2cap: sync sock recv cb and release") + +============================================ +WARNING: possible recursive locking detected +6.10.0-rc3-g4029dba6b6f1 #6823 Not tainted +-------------------------------------------- +kworker/u5:0/35 is trying to acquire lock: +ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at: +l2cap_sock_recv_cb+0x44/0x1e0 + +but task is already holding lock: +ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at: +l2cap_get_chan_by_scid+0xaf/0xd0 + +other info that might help us debug this: + Possible unsafe locking scenario: + + CPU0 + ---- + lock(&chan->lock#2/1); + lock(&chan->lock#2/1); + + *** DEADLOCK *** + + May be due to missing lock nesting notation + +3 locks held by kworker/u5:0/35: + #0: ffff888002b8a940 ((wq_completion)hci0#2){+.+.}-{0:0}, at: +process_one_work+0x750/0x930 + #1: ffff888002c67dd0 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, +at: process_one_work+0x44e/0x930 + #2: ffff888002ec2510 (&chan->lock#2/1){+.+.}-{3:3}, at: +l2cap_get_chan_by_scid+0xaf/0xd0 + +To fix the original problem this introduces l2cap_chan_lock at +l2cap_conless_channel to ensure that l2cap_sock_recv_cb is called with +chan->lock held. + +Fixes: 89e856e124f9 ("bluetooth/l2cap: sync sock recv cb and release") +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Greg Kroah-Hartman +--- + include/net/bluetooth/hci_sync.h | 2 + + net/bluetooth/hci_core.c | 72 +++++++++------------------------------ + net/bluetooth/hci_sync.c | 13 +++++++ + net/bluetooth/l2cap_core.c | 3 + + net/bluetooth/l2cap_sock.c | 13 ------- + 5 files changed, 37 insertions(+), 66 deletions(-) + +--- a/include/net/bluetooth/hci_sync.h ++++ b/include/net/bluetooth/hci_sync.h +@@ -38,6 +38,8 @@ int __hci_cmd_sync_status(struct hci_dev + int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen, + const void *param, u8 event, u32 timeout, + struct sock *sk); ++int hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen, ++ const void *param, u32 timeout); + + void hci_cmd_sync_init(struct hci_dev *hdev); + void hci_cmd_sync_clear(struct hci_dev *hdev); +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -63,50 +63,6 @@ DEFINE_MUTEX(hci_cb_list_lock); + /* HCI ID Numbering */ + static DEFINE_IDA(hci_index_ida); + +-static int hci_scan_req(struct hci_request *req, unsigned long opt) +-{ +- __u8 scan = opt; +- +- BT_DBG("%s %x", req->hdev->name, scan); +- +- /* Inquiry and Page scans */ +- hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); +- return 0; +-} +- +-static int hci_auth_req(struct hci_request *req, unsigned long opt) +-{ +- __u8 auth = opt; +- +- BT_DBG("%s %x", req->hdev->name, auth); +- +- /* Authentication */ +- hci_req_add(req, HCI_OP_WRITE_AUTH_ENABLE, 1, &auth); +- return 0; +-} +- +-static int hci_encrypt_req(struct hci_request *req, unsigned long opt) +-{ +- __u8 encrypt = opt; +- +- BT_DBG("%s %x", req->hdev->name, encrypt); +- +- /* Encryption */ +- hci_req_add(req, HCI_OP_WRITE_ENCRYPT_MODE, 1, &encrypt); +- return 0; +-} +- +-static int hci_linkpol_req(struct hci_request *req, unsigned long opt) +-{ +- __le16 policy = cpu_to_le16(opt); +- +- BT_DBG("%s %x", req->hdev->name, policy); +- +- /* Default link policy */ +- hci_req_add(req, HCI_OP_WRITE_DEF_LINK_POLICY, 2, &policy); +- return 0; +-} +- + /* Get HCI device by index. + * Device is held on return. */ + struct hci_dev *hci_dev_get(int index) +@@ -728,6 +684,7 @@ int hci_dev_cmd(unsigned int cmd, void _ + { + struct hci_dev *hdev; + struct hci_dev_req dr; ++ __le16 policy; + int err = 0; + + if (copy_from_user(&dr, arg, sizeof(dr))) +@@ -754,8 +711,8 @@ int hci_dev_cmd(unsigned int cmd, void _ + + switch (cmd) { + case HCISETAUTH: +- err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, +- HCI_INIT_TIMEOUT, NULL); ++ err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_AUTH_ENABLE, ++ 1, &dr.dev_opt, HCI_CMD_TIMEOUT); + break; + + case HCISETENCRYPT: +@@ -766,19 +723,23 @@ int hci_dev_cmd(unsigned int cmd, void _ + + if (!test_bit(HCI_AUTH, &hdev->flags)) { + /* Auth must be enabled first */ +- err = hci_req_sync(hdev, hci_auth_req, dr.dev_opt, +- HCI_INIT_TIMEOUT, NULL); ++ err = __hci_cmd_sync_status(hdev, ++ HCI_OP_WRITE_AUTH_ENABLE, ++ 1, &dr.dev_opt, ++ HCI_CMD_TIMEOUT); + if (err) + break; + } + +- err = hci_req_sync(hdev, hci_encrypt_req, dr.dev_opt, +- HCI_INIT_TIMEOUT, NULL); ++ err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_ENCRYPT_MODE, ++ 1, &dr.dev_opt, ++ HCI_CMD_TIMEOUT); + break; + + case HCISETSCAN: +- err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt, +- HCI_INIT_TIMEOUT, NULL); ++ err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE, ++ 1, &dr.dev_opt, ++ HCI_CMD_TIMEOUT); + + /* Ensure that the connectable and discoverable states + * get correctly modified as this was a non-mgmt change. +@@ -788,8 +749,11 @@ int hci_dev_cmd(unsigned int cmd, void _ + break; + + case HCISETLINKPOL: +- err = hci_req_sync(hdev, hci_linkpol_req, dr.dev_opt, +- HCI_INIT_TIMEOUT, NULL); ++ policy = cpu_to_le16(dr.dev_opt); ++ ++ err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, ++ 2, &policy, ++ HCI_CMD_TIMEOUT); + break; + + case HCISETLINKMODE: +--- a/net/bluetooth/hci_sync.c ++++ b/net/bluetooth/hci_sync.c +@@ -280,6 +280,19 @@ int __hci_cmd_sync_status(struct hci_dev + } + EXPORT_SYMBOL(__hci_cmd_sync_status); + ++int hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen, ++ const void *param, u32 timeout) ++{ ++ int err; ++ ++ hci_req_sync_lock(hdev); ++ err = __hci_cmd_sync_status(hdev, opcode, plen, param, timeout); ++ hci_req_sync_unlock(hdev); ++ ++ return err; ++} ++EXPORT_SYMBOL(hci_cmd_sync_status); ++ + static void hci_cmd_sync_work(struct work_struct *work) + { + struct hci_dev *hdev = container_of(work, struct hci_dev, cmd_sync_work); +--- a/net/bluetooth/l2cap_core.c ++++ b/net/bluetooth/l2cap_core.c +@@ -6762,6 +6762,8 @@ static void l2cap_conless_channel(struct + + BT_DBG("chan %p, len %d", chan, skb->len); + ++ l2cap_chan_lock(chan); ++ + if (chan->state != BT_BOUND && chan->state != BT_CONNECTED) + goto drop; + +@@ -6778,6 +6780,7 @@ static void l2cap_conless_channel(struct + } + + drop: ++ l2cap_chan_unlock(chan); + l2cap_chan_put(chan); + free_skb: + kfree_skb(skb); +--- a/net/bluetooth/l2cap_sock.c ++++ b/net/bluetooth/l2cap_sock.c +@@ -1500,18 +1500,9 @@ static int l2cap_sock_recv_cb(struct l2c + struct l2cap_pinfo *pi; + int err; + +- /* To avoid race with sock_release, a chan lock needs to be added here +- * to synchronize the sock. +- */ +- l2cap_chan_hold(chan); +- l2cap_chan_lock(chan); + sk = chan->data; +- +- if (!sk) { +- l2cap_chan_unlock(chan); +- l2cap_chan_put(chan); ++ if (!sk) + return -ENXIO; +- } + + pi = l2cap_pi(sk); + lock_sock(sk); +@@ -1563,8 +1554,6 @@ static int l2cap_sock_recv_cb(struct l2c + + done: + release_sock(sk); +- l2cap_chan_unlock(chan); +- l2cap_chan_put(chan); + + return err; + } diff --git a/queue-6.6/of-irq-disable-interrupt-map-parsing-for-pasemi-nemo.patch b/queue-6.6/of-irq-disable-interrupt-map-parsing-for-pasemi-nemo.patch new file mode 100644 index 00000000000..8e18efdfa98 --- /dev/null +++ b/queue-6.6/of-irq-disable-interrupt-map-parsing-for-pasemi-nemo.patch @@ -0,0 +1,68 @@ +From 2cf6b7d15a28640117bf9f75dc050892cf78a6e8 Mon Sep 17 00:00:00 2001 +From: Marc Zyngier +Date: Tue, 2 Jul 2024 22:42:46 +0100 +Subject: of/irq: Disable "interrupt-map" parsing for PASEMI Nemo + +From: Marc Zyngier + +commit 2cf6b7d15a28640117bf9f75dc050892cf78a6e8 upstream. + +Once again, we've broken PASEMI Nemo boards with its incomplete +"interrupt-map" translations. Commit 935df1bd40d4 ("of/irq: Factor out +parsing of interrupt-map parent phandle+args from of_irq_parse_raw()") +changed the behavior resulting in the existing work-around not taking +effect. Rework the work-around to just skip parsing "interrupt-map" up +front by using the of_irq_imap_abusers list. + +Fixes: 935df1bd40d4 ("of/irq: Factor out parsing of interrupt-map parent phandle+args from of_irq_parse_raw()") +Reported-by: Christian Zigotzky +Signed-off-by: Marc Zyngier +Link: https://lore.kernel.org/r/86ed8ba2sp.wl-maz@kernel.org +Signed-off-by: Rob Herring (Arm) +Signed-off-by: Greg Kroah-Hartman +--- + drivers/of/irq.c | 18 ++++-------------- + 1 file changed, 4 insertions(+), 14 deletions(-) + +--- a/drivers/of/irq.c ++++ b/drivers/of/irq.c +@@ -81,7 +81,8 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); + /* + * These interrupt controllers abuse interrupt-map for unspeakable + * reasons and rely on the core code to *ignore* it (the drivers do +- * their own parsing of the property). ++ * their own parsing of the property). The PAsemi entry covers a ++ * non-sensical interrupt-map that is better left ignored. + * + * If you think of adding to the list for something *new*, think + * again. There is a high chance that you will be sent back to the +@@ -95,6 +96,7 @@ static const char * const of_irq_imap_ab + "fsl,ls1043a-extirq", + "fsl,ls1088a-extirq", + "renesas,rza1-irqc", ++ "pasemi,rootbus", + NULL, + }; + +@@ -293,20 +295,8 @@ int of_irq_parse_raw(const __be32 *addr, + imaplen -= imap - oldimap; + pr_debug(" -> imaplen=%d\n", imaplen); + } +- if (!match) { +- if (intc) { +- /* +- * The PASEMI Nemo is a known offender, so +- * let's only warn for anyone else. +- */ +- WARN(!IS_ENABLED(CONFIG_PPC_PASEMI), +- "%pOF interrupt-map failed, using interrupt-controller\n", +- ipar); +- return 0; +- } +- ++ if (!match) + goto fail; +- } + + /* + * Successfully parsed an interrupt-map translation; copy new diff --git a/queue-6.6/series b/queue-6.6/series index ddef35fad6c..5c708d14db9 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -119,3 +119,7 @@ alsa-hda-use-imply-for-suggesting-config_serial_mult.patch cifs-fix-noisy-message-on-copy_file_range.patch arm-9324-1-fix-get_user-broken-with-veneer.patch mm-page_ref-remove-folio_try_get_rcu.patch +bluetooth-l2cap-fix-deadlock.patch +of-irq-disable-interrupt-map-parsing-for-pasemi-nemo.patch +wifi-cfg80211-wext-set-ssids-null-for-passive-scans.patch +wifi-mac80211-disable-softirqs-for-queued-frame-handling.patch diff --git a/queue-6.6/wifi-cfg80211-wext-set-ssids-null-for-passive-scans.patch b/queue-6.6/wifi-cfg80211-wext-set-ssids-null-for-passive-scans.patch new file mode 100644 index 00000000000..080df0e12f6 --- /dev/null +++ b/queue-6.6/wifi-cfg80211-wext-set-ssids-null-for-passive-scans.patch @@ -0,0 +1,41 @@ +From 0941772342d59e48733131ac3a202fa1a4d832e9 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Tue, 11 Jun 2024 18:58:16 +0200 +Subject: wifi: cfg80211: wext: set ssids=NULL for passive scans + +From: Johannes Berg + +commit 0941772342d59e48733131ac3a202fa1a4d832e9 upstream. + +In nl80211, we always set the ssids of a scan request to +NULL when n_ssids==0 (passive scan). Drivers have relied +on this behaviour in the past, so we fixed it in 6 GHz +scan requests as well, and added a warning so we'd have +assurance the API would always be called that way. + +syzbot found that wext doesn't ensure that, so we reach +the check and trigger the warning. Fix the wext code to +set the ssids pointer to NULL when there are none. + +Reported-by: syzbot+cd6135193ba6bb9ad158@syzkaller.appspotmail.com +Fixes: f7a8b10bfd61 ("wifi: cfg80211: fix 6 GHz scan request building") +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman +--- + net/wireless/scan.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -3259,8 +3259,10 @@ int cfg80211_wext_siwscan(struct net_dev + memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); + creq->ssids[0].ssid_len = wreq->essid_len; + } +- if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE) ++ if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE) { ++ creq->ssids = NULL; + creq->n_ssids = 0; ++ } + } + + for (i = 0; i < NUM_NL80211_BANDS; i++) diff --git a/queue-6.6/wifi-mac80211-disable-softirqs-for-queued-frame-handling.patch b/queue-6.6/wifi-mac80211-disable-softirqs-for-queued-frame-handling.patch new file mode 100644 index 00000000000..4b2d5705f02 --- /dev/null +++ b/queue-6.6/wifi-mac80211-disable-softirqs-for-queued-frame-handling.patch @@ -0,0 +1,46 @@ +From 321028bc45f01edb9e57b0ae5c11c5c3600d00ca Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Wed, 26 Jun 2024 09:15:59 +0200 +Subject: wifi: mac80211: disable softirqs for queued frame handling + +From: Johannes Berg + +commit 321028bc45f01edb9e57b0ae5c11c5c3600d00ca upstream. + +As noticed by syzbot, calling ieee80211_handle_queued_frames() +(and actually handling frames there) requires softirqs to be +disabled, since we call into the RX code. Fix that in the case +of cleaning up frames left over during shutdown. + +Fixes: 177c6ae9725d ("wifi: mac80211: handle tasklet frames before stopping") +Reported-by: syzbot+1d516edf1e74469ba5d3@syzkaller.appspotmail.com +Link: https://patch.msgid.link/20240626091559.cd6f08105a6e.I74778610a5ff2cf8680964698131099d2960352a@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman +--- + net/mac80211/main.c | 1 + + net/mac80211/util.c | 2 ++ + 2 files changed, 3 insertions(+) + +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -301,6 +301,7 @@ u64 ieee80211_reset_erp_info(struct ieee + BSS_CHANGED_ERP_SLOT; + } + ++/* context: requires softirqs disabled */ + void ieee80211_handle_queued_frames(struct ieee80211_local *local) + { + struct sk_buff *skb; +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -2313,7 +2313,9 @@ u32 ieee80211_sta_get_rates(struct ieee8 + + void ieee80211_stop_device(struct ieee80211_local *local) + { ++ local_bh_disable(); + ieee80211_handle_queued_frames(local); ++ local_bh_enable(); + + ieee80211_led_radio(local, false); + ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO);