Skip to content

Commit 255cc1d

Browse files
GoodLuck612gregkh
authored andcommitted
wifi: mwifiex: Fix memory leak in mwifiex_11n_aggregate_pkt()
[ Upstream commit 990a73d ] 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: 5e6e3a9 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a5af71c commit 255cc1d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/net/wireless/marvell/mwifiex/11n_aggr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
203203

204204
if (!mwifiex_is_ralist_valid(priv, pra_list, ptrindex)) {
205205
spin_unlock_bh(&priv->wmm.ra_list_spinlock);
206+
mwifiex_write_data_complete(adapter, skb_aggr, 1, -1);
206207
return -1;
207208
}
208209

0 commit comments

Comments
 (0)