* [PATCH v2] wifi: ath12k: clear dangling channel pointers on error paths
@ 2026-08-11 2:05 Linkai Gong
2026-08-11 2:32 ` Baochen Qiang
2026-08-17 4:23 ` Rameshkumar Sundaram
0 siblings, 2 replies; 3+ messages in thread
From: Linkai Gong @ 2026-08-11 2:05 UTC (permalink / raw)
To: jjohnson
Cc: vasanthakumar.thiagarajan, rameshkumar.sundaram, baochen.qiang,
linux-wireless, ath12k, linux-kernel, Linkai Gong
On failure, ath12k_mac_setup_channels_rates() frees band channel
arrays but leaves the pointers set, or clears the wrong band after a
copy-paste typo (6 GHz free paired with a 2 GHz NULL). Clear the
matching sbands[].channels pointer after each kfree().
Compile tested only.
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
v2:
- reword commit message (dangling pointers + typo, not double-free)
- drop Fixes tag
- note compile tested only
v1: https://lore.kernel.org/all/20260731093816.1771338-1-gonglinkai@kylinos.cn/
drivers/net/wireless/ath/ath12k/mac.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index a0928890671a..5468a8d2d5d5 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -14275,6 +14275,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
sizeof(ath12k_6ghz_channels), GFP_KERNEL);
if (!channels) {
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
+ ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
return -ENOMEM;
}
@@ -14325,7 +14326,9 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
GFP_KERNEL);
if (!channels) {
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
+ ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
+ ar->mac.sbands[NL80211_BAND_6GHZ].channels = NULL;
return -ENOMEM;
}
@@ -14365,7 +14368,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
- ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
+ ar->mac.sbands[NL80211_BAND_6GHZ].channels = NULL;
kfree(channels);
band->channels = NULL;
return ret;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: ath12k: clear dangling channel pointers on error paths
2026-08-11 2:05 [PATCH v2] wifi: ath12k: clear dangling channel pointers on error paths Linkai Gong
@ 2026-08-11 2:32 ` Baochen Qiang
2026-08-17 4:23 ` Rameshkumar Sundaram
1 sibling, 0 replies; 3+ messages in thread
From: Baochen Qiang @ 2026-08-11 2:32 UTC (permalink / raw)
To: Linkai Gong, jjohnson
Cc: vasanthakumar.thiagarajan, rameshkumar.sundaram, linux-wireless,
ath12k, linux-kernel
On 8/11/2026 10:05 AM, Linkai Gong wrote:
> On failure, ath12k_mac_setup_channels_rates() frees band channel
> arrays but leaves the pointers set, or clears the wrong band after a
> copy-paste typo (6 GHz free paired with a 2 GHz NULL). Clear the
> matching sbands[].channels pointer after each kfree().
>
> Compile tested only.
>
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] wifi: ath12k: clear dangling channel pointers on error paths
2026-08-11 2:05 [PATCH v2] wifi: ath12k: clear dangling channel pointers on error paths Linkai Gong
2026-08-11 2:32 ` Baochen Qiang
@ 2026-08-17 4:23 ` Rameshkumar Sundaram
1 sibling, 0 replies; 3+ messages in thread
From: Rameshkumar Sundaram @ 2026-08-17 4:23 UTC (permalink / raw)
To: Linkai Gong, jjohnson
Cc: vasanthakumar.thiagarajan, baochen.qiang, linux-wireless, ath12k,
linux-kernel
On 8/11/2026 7:35 AM, Linkai Gong wrote:
> On failure, ath12k_mac_setup_channels_rates() frees band channel
> arrays but leaves the pointers set, or clears the wrong band after a
> copy-paste typo (6 GHz free paired with a 2 GHz NULL). Clear the
> matching sbands[].channels pointer after each kfree().
>
> Compile tested only.
>
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
> ---
> v2:
> - reword commit message (dangling pointers + typo, not double-free)
> - drop Fixes tag
> - note compile tested only
>
> v1: https://lore.kernel.org/all/20260731093816.1771338-1-gonglinkai@kylinos.cn/
>
> drivers/net/wireless/ath/ath12k/mac.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index a0928890671a..5468a8d2d5d5 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -14275,6 +14275,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
> sizeof(ath12k_6ghz_channels), GFP_KERNEL);
> if (!channels) {
> kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
> + ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
> return -ENOMEM;
> }
>
> @@ -14325,7 +14326,9 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
> GFP_KERNEL);
> if (!channels) {
> kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
> + ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
> kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
> + ar->mac.sbands[NL80211_BAND_6GHZ].channels = NULL;
> return -ENOMEM;
> }
>
> @@ -14365,7 +14368,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
> kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
> ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
> kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
> - ar->mac.sbands[NL80211_BAND_2GHZ].channels = NULL;
> + ar->mac.sbands[NL80211_BAND_6GHZ].channels = NULL;
> kfree(channels);
> band->channels = NULL;
> return ret;
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-17 4:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 2:05 [PATCH v2] wifi: ath12k: clear dangling channel pointers on error paths Linkai Gong
2026-08-11 2:32 ` Baochen Qiang
2026-08-17 4:23 ` Rameshkumar Sundaram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox