From: Greg Kroah-Hartman Date: Mon, 30 Dec 2024 12:34:54 +0000 (+0100) Subject: 6.12-stable patches X-Git-Tag: v6.1.123~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=77359549468bf64ceeb840708be5417b7f413148;p=thirdparty%2Fkernel%2Fstable-queue.git 6.12-stable patches added patches: bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch --- diff --git a/queue-6.12/bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch b/queue-6.12/bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch new file mode 100644 index 00000000000..6339daa9d2f --- /dev/null +++ b/queue-6.12/bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch @@ -0,0 +1,40 @@ +From cea1805f165cdd783dd21f26df957118cb8641b4 Mon Sep 17 00:00:00 2001 +From: Chris Lu +Date: Mon, 23 Sep 2024 16:47:03 +0800 +Subject: Bluetooth: btusb: mediatek: add callback function in btusb_disconnect + +From: Chris Lu + +commit cea1805f165cdd783dd21f26df957118cb8641b4 upstream. + +Add disconnect callback function in btusb_disconnect which is reserved +for vendor specific usage before deregister hci in btusb_disconnect. + +Signed-off-by: Chris Lu +Signed-off-by: Luiz Augusto von Dentz +Cc: Fedor Pchelkin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/btusb.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -870,6 +870,7 @@ struct btusb_data { + + int (*suspend)(struct hci_dev *hdev); + int (*resume)(struct hci_dev *hdev); ++ int (*disconnect)(struct hci_dev *hdev); + + int oob_wake_irq; /* irq for out-of-band wake-on-bt */ + unsigned cmd_timeout_cnt; +@@ -4043,6 +4044,9 @@ static void btusb_disconnect(struct usb_ + if (data->diag) + usb_set_intfdata(data->diag, NULL); + ++ if (data->disconnect) ++ data->disconnect(hdev); ++ + hci_unregister_dev(hdev); + + if (intf == data->intf) { diff --git a/queue-6.12/bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch b/queue-6.12/bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch new file mode 100644 index 00000000000..92971e13277 --- /dev/null +++ b/queue-6.12/bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch @@ -0,0 +1,86 @@ +From 489304e67087abddc2666c5af0159cb95afdcf59 Mon Sep 17 00:00:00 2001 +From: Chris Lu +Date: Mon, 23 Sep 2024 16:47:04 +0800 +Subject: Bluetooth: btusb: mediatek: add intf release flow when usb disconnect + +From: Chris Lu + +commit 489304e67087abddc2666c5af0159cb95afdcf59 upstream. + +MediaTek claim an special usb intr interface for ISO data transmission. +The interface need to be released before unregistering hci device when +usb disconnect. Removing BT usb dongle without properly releasing the +interface may cause Kernel panic while unregister hci device. + +Signed-off-by: Chris Lu +Signed-off-by: Luiz Augusto von Dentz +Cc: Fedor Pchelkin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/btusb.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -2644,9 +2644,9 @@ static void btusb_mtk_claim_iso_intf(str + init_usb_anchor(&btmtk_data->isopkt_anchor); + } + +-static void btusb_mtk_release_iso_intf(struct btusb_data *data) ++static void btusb_mtk_release_iso_intf(struct hci_dev *hdev) + { +- struct btmtk_data *btmtk_data = hci_get_priv(data->hdev); ++ struct btmtk_data *btmtk_data = hci_get_priv(hdev); + + if (btmtk_data->isopkt_intf) { + usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor); +@@ -2662,6 +2662,16 @@ static void btusb_mtk_release_iso_intf(s + clear_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags); + } + ++static int btusb_mtk_disconnect(struct hci_dev *hdev) ++{ ++ /* This function describes the specific additional steps taken by MediaTek ++ * when Bluetooth usb driver's resume function is called. ++ */ ++ btusb_mtk_release_iso_intf(hdev); ++ ++ return 0; ++} ++ + static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data) + { + struct btusb_data *data = hci_get_drvdata(hdev); +@@ -2679,7 +2689,7 @@ static int btusb_mtk_reset(struct hci_de + return err; + + if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags)) +- btusb_mtk_release_iso_intf(data); ++ btusb_mtk_release_iso_intf(hdev); + + btusb_stop_traffic(data); + usb_kill_anchored_urbs(&data->tx_anchor); +@@ -2733,14 +2743,13 @@ static int btusb_mtk_setup(struct hci_de + + static int btusb_mtk_shutdown(struct hci_dev *hdev) + { +- struct btusb_data *data = hci_get_drvdata(hdev); + struct btmtk_data *btmtk_data = hci_get_priv(hdev); + int ret; + + ret = btmtk_usb_shutdown(hdev); + + if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags)) +- btusb_mtk_release_iso_intf(data); ++ btusb_mtk_release_iso_intf(hdev); + + return ret; + } +@@ -3854,6 +3863,7 @@ static int btusb_probe(struct usb_interf + data->recv_acl = btmtk_usb_recv_acl; + data->suspend = btmtk_usb_suspend; + data->resume = btmtk_usb_resume; ++ data->disconnect = btusb_mtk_disconnect; + } + + if (id->driver_info & BTUSB_SWAVE) { diff --git a/queue-6.12/bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch b/queue-6.12/bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch new file mode 100644 index 00000000000..b6dd765c662 --- /dev/null +++ b/queue-6.12/bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch @@ -0,0 +1,70 @@ +From defc33b5541e0a7e45cc2d99d72fbe80a597afc5 Mon Sep 17 00:00:00 2001 +From: Chris Lu +Date: Mon, 23 Sep 2024 16:47:05 +0800 +Subject: Bluetooth: btusb: mediatek: change the conditions for ISO interface + +From: Chris Lu + +commit defc33b5541e0a7e45cc2d99d72fbe80a597afc5 upstream. + +Change conditions for Bluetooth driver claiming and releasing usb +ISO interface for MediaTek ISO data transmission. + +Signed-off-by: Chris Lu +Signed-off-by: Luiz Augusto von Dentz +Cc: Fedor Pchelkin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/btusb.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -2648,7 +2648,7 @@ static void btusb_mtk_release_iso_intf(s + { + struct btmtk_data *btmtk_data = hci_get_priv(hdev); + +- if (btmtk_data->isopkt_intf) { ++ if (test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) { + usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor); + clear_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags); + +@@ -2688,8 +2688,8 @@ static int btusb_mtk_reset(struct hci_de + if (err < 0) + return err; + +- if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags)) +- btusb_mtk_release_iso_intf(hdev); ++ /* Release MediaTek ISO data interface */ ++ btusb_mtk_release_iso_intf(hdev); + + btusb_stop_traffic(data); + usb_kill_anchored_urbs(&data->tx_anchor); +@@ -2734,22 +2734,22 @@ static int btusb_mtk_setup(struct hci_de + btmtk_data->reset_sync = btusb_mtk_reset; + + /* Claim ISO data interface and endpoint */ +- btmtk_data->isopkt_intf = usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM); +- if (btmtk_data->isopkt_intf) ++ if (!test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) { ++ btmtk_data->isopkt_intf = usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM); + btusb_mtk_claim_iso_intf(data); ++ } + + return btmtk_usb_setup(hdev); + } + + static int btusb_mtk_shutdown(struct hci_dev *hdev) + { +- struct btmtk_data *btmtk_data = hci_get_priv(hdev); + int ret; + + ret = btmtk_usb_shutdown(hdev); + +- if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags)) +- btusb_mtk_release_iso_intf(hdev); ++ /* Release MediaTek iso interface after shutdown */ ++ btusb_mtk_release_iso_intf(hdev); + + return ret; + } diff --git a/queue-6.12/bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch b/queue-6.12/bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch new file mode 100644 index 00000000000..171132100e5 --- /dev/null +++ b/queue-6.12/bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch @@ -0,0 +1,38 @@ +From ad0c6f603bb0b07846fda484c59a176a8cd02838 Mon Sep 17 00:00:00 2001 +From: Chris Lu +Date: Mon, 23 Sep 2024 16:47:02 +0800 +Subject: Bluetooth: btusb: mediatek: move Bluetooth power off command position + +From: Chris Lu + +commit ad0c6f603bb0b07846fda484c59a176a8cd02838 upstream. + +Move MediaTek Bluetooth power off command before releasing +usb ISO interface. + +Signed-off-by: Chris Lu +Signed-off-by: Luiz Augusto von Dentz +Cc: Fedor Pchelkin +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/btusb.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -2734,11 +2734,14 @@ static int btusb_mtk_shutdown(struct hci + { + struct btusb_data *data = hci_get_drvdata(hdev); + struct btmtk_data *btmtk_data = hci_get_priv(hdev); ++ int ret; ++ ++ ret = btmtk_usb_shutdown(hdev); + + if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags)) + btusb_mtk_release_iso_intf(data); + +- return btmtk_usb_shutdown(hdev); ++ return ret; + } + + #ifdef CONFIG_PM diff --git a/queue-6.12/series b/queue-6.12/series index a1122f7b358..4d043db5dad 100644 --- a/queue-6.12/series +++ b/queue-6.12/series @@ -107,3 +107,7 @@ btrfs-sysfs-fix-direct-super-block-member-reads.patch btrfs-fix-use-after-free-when-cowing-tree-bock-and-tracing-is-enabled.patch btrfs-check-folio-mapping-after-unlock-in-put_file_data.patch btrfs-check-folio-mapping-after-unlock-in-relocate_one_folio.patch +bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch +bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch +bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch +bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch