]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: pci: not assert wiphy_lock to free early_h2c for PCI probe/remove
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 22 Jan 2025 06:03:10 +0000 (14:03 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 3 Feb 2025 02:30:16 +0000 (10:30 +0800)
Except probe/remove flow, the consumers of early_h2c list are interface
start and debugfs. There must be no race between probe/remove flow and
interface start. The failed probe flow is to free early_h2c list as well
as remove flow, at these two moments debugfs doesn't present. Thus, it is
safe to free early_h2c list without held wiphy_lock in these situations.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250122060310.31976-11-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h

index 559191a49c5a4b92979b7ad775afd50eb90389e2..da41a417dd7d3425d02e993333faaef9745ae753 100644 (file)
@@ -4885,7 +4885,7 @@ void rtw89_core_deinit(struct rtw89_dev *rtwdev)
 {
        rtw89_ser_deinit(rtwdev);
        rtw89_unload_firmware(rtwdev);
-       rtw89_fw_free_all_early_h2c(rtwdev);
+       __rtw89_fw_free_all_early_h2c(rtwdev);
 
        destroy_workqueue(rtwdev->txq_wq);
        mutex_destroy(&rtwdev->rf_mutex);
index 2982ec367d9d5a595eb2ae6fcfb616e6c5f65d99..1afce0a0b9053d4b41a6c68639ccee7f47201eff 100644 (file)
@@ -6103,12 +6103,10 @@ void rtw89_fw_send_all_early_h2c(struct rtw89_dev *rtwdev)
        }
 }
 
-void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev)
+void __rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev)
 {
        struct rtw89_early_h2c *early_h2c, *tmp;
 
-       lockdep_assert_wiphy(rtwdev->hw->wiphy);
-
        list_for_each_entry_safe(early_h2c, tmp, &rtwdev->early_h2c_list, list) {
                list_del(&early_h2c->list);
                kfree(early_h2c->h2c);
@@ -6116,6 +6114,13 @@ void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev)
        }
 }
 
+void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev)
+{
+       lockdep_assert_wiphy(rtwdev->hw->wiphy);
+
+       __rtw89_fw_free_all_early_h2c(rtwdev);
+}
+
 static void rtw89_fw_c2h_parse_attr(struct sk_buff *c2h)
 {
        const struct rtw89_c2h_hdr *hdr = (const struct rtw89_c2h_hdr *)c2h->data;
index b621dbed2c615cc0f3fe4210fbe365a5e66c172f..fb107c0a29d7f9db01398b9d4d5365a59a2bc10d 100644 (file)
@@ -4665,6 +4665,7 @@ int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
                              bool rack, bool dack);
 int rtw89_fw_h2c_raw(struct rtw89_dev *rtwdev, const u8 *buf, u16 len);
 void rtw89_fw_send_all_early_h2c(struct rtw89_dev *rtwdev);
+void __rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev);
 void rtw89_fw_free_all_early_h2c(struct rtw89_dev *rtwdev);
 int rtw89_fw_h2c_general_pkt(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link,
                             u8 macid);