From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH rtw-next] wifi: rtw89: regd: avoid freeing devm-allocated 6 GHz band
Date: Sun, 29 Nov 2026 09:44:38 +0100 [thread overview]
Message-ID: <20261129084438.57812-1-pepe.schlehofer@gmail.com> (raw)
When ACPI disallows 6 GHz, rtw89_regd_setup_6ghz() frees the band and
its iftype data with kfree(), even though both are devm-allocated.
Devres then frees them again during device teardown.
Only clear the wiphy band pointer and leave the allocations to devres.
Fixes: 145df52a8671 ("wifi: rtw89: Convert rtw89_core_set_supported_band to use devm_*")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
Compile-tested only. The path needs ACPI that disallows 6 GHz, and rtw89
skips that ACPI check on USB, so my RTL8922AU cannot reach it.
drivers/net/wireless/realtek/rtw89/regd.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/regd.c b/drivers/net/wireless/realtek/rtw89/regd.c
index 017e6a2b4b0..e8a383c6680 100644
--- a/drivers/net/wireless/realtek/rtw89/regd.c
+++ b/drivers/net/wireless/realtek/rtw89/regd.c
@@ -590,7 +590,6 @@ static void rtw89_regd_setup_6ghz(struct rtw89_dev *rtwdev, struct wiphy *wiphy)
bool chip_support_6ghz = test_bit(NL80211_BAND_6GHZ, rtwdev->supported_bands);
bool skip_acpi_dsm = rtwdev->hci.type == RTW89_HCI_TYPE_USB;
bool regd_allow_6ghz = chip_support_6ghz;
- struct ieee80211_supported_band *sband;
struct rtw89_acpi_dsm_result res = {};
int ret;
u8 val;
@@ -635,13 +634,7 @@ static void rtw89_regd_setup_6ghz(struct rtw89_dev *rtwdev, struct wiphy *wiphy)
return;
}
- sband = wiphy->bands[NL80211_BAND_6GHZ];
- if (!sband)
- return;
-
wiphy->bands[NL80211_BAND_6GHZ] = NULL;
- kfree((__force void *)sband->iftype_data);
- kfree(sband);
}
#define RTW89_DEF_REGD_STR(regd) \
--
2.54.0 (Apple Git-157)
next reply other threads:[~2026-11-29 8:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 8:44 Josef Schlehofer [this message]
2026-11-30 4:03 ` [PATCH rtw-next] wifi: rtw89: regd: avoid freeing devm-allocated 6 GHz band Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261129084438.57812-1-pepe.schlehofer@gmail.com \
--to=pepe.schlehofer@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=pkshih@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox