Skip to content
/ linux Public

Commit a968c6a

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 ff1b8bc commit a968c6a

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
@@ -318,9 +318,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
318318
len, notify_signal, GFP_ATOMIC);
319319

320320
if (unlikely(!bss))
321-
goto exit;
321+
goto free_buf;
322322

323323
cfg80211_put_bss(wiphy, bss);
324+
free_buf:
324325
kfree(buf);
325326

326327
exit:

0 commit comments

Comments
 (0)