* [PATCH wireless] wifi: nxpwifi: fix NULL deref and leak in authenticate
@ 2026-10-01 16:17 techyminati
2026-10-05 16:31 ` jeff.chen_1
0 siblings, 1 reply; 2+ messages in thread
From: techyminati @ 2026-10-01 16:17 UTC (permalink / raw)
To: Jeff Chen, Johannes Berg
Cc: Francesco Dolcini, linux-wireless, linux-kernel, Aryan Sinha
From: Aryan Sinha <sinha.aryan03@gmail.com>
mgmt is allocated but never checked, and the auth frame is filled in
right after, so a failed kzalloc ends up dereferencing NULL. The skb
error path also returns without freeing mgmt.
Hence, Check the allocation, and free mgmt when the skb alloc fails.
Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x")
Signed-off-by: Aryan Sinha <sinha.aryan03@gmail.com>
---
drivers/net/wireless/nxp/nxpwifi/cfg80211.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
index 86304ea33..9eb809caa 100644
--- a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
+++ b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
@@ -3403,6 +3403,8 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy,
pkt_len -= 4;
mgmt = kzalloc(pkt_len, GFP_KERNEL);
+ if (!mgmt)
+ return -ENOMEM;
skb = dev_alloc_skb(NXPWIFI_MIN_DATA_HEADER_LEN +
NXPWIFI_MGMT_FRAME_HEADER_SIZE +
@@ -3410,6 +3412,7 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy,
if (!skb) {
nxpwifi_dbg(adapter, ERROR,
"allocate skb failed for management frame\n");
+ kfree(mgmt);
return -ENOMEM;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH wireless] wifi: nxpwifi: fix NULL deref and leak in authenticate
2026-10-01 16:17 [PATCH wireless] wifi: nxpwifi: fix NULL deref and leak in authenticate techyminati
@ 2026-10-05 16:31 ` jeff.chen_1
0 siblings, 0 replies; 2+ messages in thread
From: jeff.chen_1 @ 2026-10-05 16:31 UTC (permalink / raw)
To: techyminati
Cc: Jeff Chen, Jeff Chen, Johannes Berg, Francesco Dolcini,
linux-wireless, linux-kernel
From: Jeff Chen <jeff.chen_1@oss.nxp.com>
On Thu, Oct 01, 2026 at 09:47:13 PM +0530, techyminati wrote:
> From: Aryan Sinha <sinha.aryan03@gmail.com>
>
> diff --git a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
> index 86304ea33..9eb809caa 100644
> --- a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
> +++ b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c
> @@ -3403,6 +3403,8 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy,
> pkt_len -= 4;
>
> mgmt = kzalloc(pkt_len, GFP_KERNEL);
> + if (!mgmt)
> + return -ENOMEM;
>
> skb = dev_alloc_skb(NXPWIFI_MIN_DATA_HEADER_LEN +
> NXPWIFI_MGMT_FRAME_HEADER_SIZE +
> @@ -3410,6 +3412,7 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy,
> if (!skb) {
> nxpwifi_dbg(adapter, ERROR,
> "allocate skb failed for management frame\n");
> + kfree(mgmt);
> return -ENOMEM;
> }
>
Hi Aryan,
Thanks for the patch.
This issue has already been addressed by another accepted patch:
https://patchwork.kernel.org/project/linux-wireless/patch/20260820081634.4043666-3-lilinmao@kylinos.cn/
Thanks,
Jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-05 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01 16:17 [PATCH wireless] wifi: nxpwifi: fix NULL deref and leak in authenticate techyminati
2026-10-05 16:31 ` jeff.chen_1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox