]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: fix memory leak on failure path
authorDiksha Kumari <dikshakdevgan@gmail.com>
Tue, 13 Jan 2026 09:17:12 +0000 (14:47 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2026 13:09:00 +0000 (14:09 +0100)
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>
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c

index 60edeae1cffe7137129c9d91451bb8cfb5655df5..476ab055e53e5a392758752ea76dd4ae93a62471 100644 (file)
@@ -315,9 +315,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
                                        len, notify_signal, GFP_ATOMIC);
 
        if (unlikely(!bss))
-               goto exit;
+               goto free_buf;
 
        cfg80211_put_bss(wiphy, bss);
+free_buf:
        kfree(buf);
 
 exit: