diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:49:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:49:59 +0000 |
commit | 01997497f915e8f79871f3f2acb55ac465051d24 (patch) | |
tree | 1ce1afd7246e1014199e15cbf854bf7924458e5d /debian/patches/bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch | |
parent | Adding upstream version 6.1.76. (diff) | |
download | linux-debian/6.1.76-1.tar.xz linux-debian/6.1.76-1.zip |
Adding debian version 6.1.76-1.debian/6.1.76-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch')
-rw-r--r-- | debian/patches/bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/debian/patches/bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch b/debian/patches/bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch new file mode 100644 index 000000000..4635a6778 --- /dev/null +++ b/debian/patches/bugfix/all/wifi-mt76-do-not-run-mt76_unregister_device-on-unregistered-hw.patch @@ -0,0 +1,78 @@ +From: Lorenzo Bianconi <lorenzo@kernel.org> +Date: Thu, 23 Feb 2023 00:10:25 +0100 +Subject: wifi: mt76: do not run mt76_unregister_device() on unregistered hw +Origin: https://patchwork.kernel.org/project/linux-wireless/patch/be3457d82f4e44bb71a22b2b5db27b644a37b1e1.1677107277.git.lorenzo@kernel.org/ +Bug-Debian: https://bugs.debian.org/1029116 + +Trying to probe a mt7921e pci card without firmware results in a +successful probe where ieee80211_register_hw hasn't been called. When +removing the driver, ieee802111_unregister_hw is called unconditionally +leading to a kernel NULL pointer dereference. +Fix the issue running mt76_unregister_device routine just for registered +hw. + +Link: https://bugs.debian.org/1029116 +Link: https://bugs.kali.org/view.php?id=8140 +Reported-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com> +Fixes: 1c71e03afe4b ("mt76: mt7921: move mt7921_init_hw in a dedicated work") +Tested-by: Helmut Grohne <helmut@freexian.com> +Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> + +Currently queued for review for the v6.3 release cycle, backported in +advance to prevent users from getting stuck in the installer. + +Signed-off-by: Cyril Brulebois <kibi@debian.org> + +--- + drivers/net/wireless/mediatek/mt76/mac80211.c | 8 ++++++++ + drivers/net/wireless/mediatek/mt76/mt76.h | 1 + + 2 files changed, 9 insertions(+) + +--- a/drivers/net/wireless/mediatek/mt76/mac80211.c ++++ b/drivers/net/wireless/mediatek/mt76/mac80211.c +@@ -522,6 +522,7 @@ int mt76_register_phy(struct mt76_phy *p + if (ret) + return ret; + ++ set_bit(MT76_STATE_REGISTERED, &phy->state); + phy->dev->phys[phy->band_idx] = phy; + + return 0; +@@ -532,6 +533,9 @@ void mt76_unregister_phy(struct mt76_phy + { + struct mt76_dev *dev = phy->dev; + ++ if (!test_bit(MT76_STATE_REGISTERED, &phy->state)) ++ return; ++ + mt76_tx_status_check(dev, true); + ieee80211_unregister_hw(phy->hw); + dev->phys[phy->band_idx] = NULL; +@@ -654,6 +658,7 @@ int mt76_register_device(struct mt76_dev + return ret; + + WARN_ON(mt76_worker_setup(hw, &dev->tx_worker, NULL, "tx")); ++ set_bit(MT76_STATE_REGISTERED, &phy->state); + sched_set_fifo_low(dev->tx_worker.task); + + return 0; +@@ -664,6 +669,9 @@ void mt76_unregister_device(struct mt76_ + { + struct ieee80211_hw *hw = dev->hw; + ++ if (!test_bit(MT76_STATE_REGISTERED, &dev->phy.state)) ++ return; ++ + if (IS_ENABLED(CONFIG_MT76_LEDS)) + mt76_led_cleanup(dev); + mt76_tx_status_check(dev, true); +--- a/drivers/net/wireless/mediatek/mt76/mt76.h ++++ b/drivers/net/wireless/mediatek/mt76/mt76.h +@@ -388,6 +388,7 @@ struct mt76_tx_cb { + + enum { + MT76_STATE_INITIALIZED, ++ MT76_STATE_REGISTERED, + MT76_STATE_RUNNING, + MT76_STATE_MCU_RUNNING, + MT76_SCANNING, |