]> git.ipfire.org Git - thirdparty/linux.git/commit
wifi: mwifiex: Fix memory leak in mwifiex_11n_aggregate_pkt()
authorZilin Guan <zilin@seu.edu.cn>
Mon, 19 Jan 2026 09:26:25 +0000 (09:26 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 2 Mar 2026 07:17:22 +0000 (08:17 +0100)
commit990a73dec3fdc145fef6c827c29205437d533ece
treea3654ab3afa9c73aad45eeef782d8c3dfdbf8442
parent0314e382cf02983eb3c33ac537ad9701e7858bc9
wifi: mwifiex: Fix memory leak in mwifiex_11n_aggregate_pkt()

In mwifiex_11n_aggregate_pkt(), skb_aggr is allocated via
mwifiex_alloc_dma_align_buf(). If mwifiex_is_ralist_valid() returns false,
the function currently returns -1 immediately without freeing the
previously allocated skb_aggr, causing a memory leak.

Since skb_aggr has not yet been queued via skb_queue_tail(), no other
references to this memory exist. Therefore, it has to be freed locally
before returning the error.

Fix this by calling mwifiex_write_data_complete() to free skb_aggr before
returning the error status.

Compile tested only. Issue found using a prototype static analysis tool
and code review.

Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com>
Link: https://patch.msgid.link/20260119092625.1349934-1-zilin@seu.edu.cn
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/marvell/mwifiex/11n_aggr.c