Skip to content
/ linux Public

Commit 8311bb4

Browse files
Diksha KumariSasha Levin
authored andcommitted
staging: rtl8723bs: fix memory leak on failure path
[ Upstream commit abe850d ] cfg80211_inform_bss_frame() may return NULL on failure. In that case, the allocated buffer 'buf' is not freed and the function returns early, leading to potential memory leak. Fix this by ensuring that 'buf' is freed on both success and failure paths. Signed-off-by: Diksha Kumari <dikshakdevgan@gmail.com> Reviewed-by: Mukesh Kumar Chaurasiya <mkchauras@linux.ibm.com> Link: https://patch.msgid.link/20260113091712.7071-1-dikshakdevgan@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 03a2f7f commit 8311bb4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
316316
len, notify_signal, GFP_ATOMIC);
317317

318318
if (unlikely(!bss))
319-
goto exit;
319+
goto free_buf;
320320

321321
cfg80211_put_bss(wiphy, bss);
322+
free_buf:
322323
kfree(buf);
323324

324325
exit:

0 commit comments

Comments
 (0)