From: Diksha Kumari <dikshakdevgan@gmail.com>
To: gregkh@linuxfoundation.org, johannes.berg@intel.com,
straube.linux@gmail.com, knavaneeth786@gmail.com,
dan.carpenter@linaro.org, quic_rdevanat@quicinc.com,
arend.vanspriel@broadcom.com, linux-staging@lists.linux.dev
Cc: Diksha Kumari <dikshakdevgan@gmail.com>
Subject: [PATCH] rtl8723bs: fix memory leak on failure path
Date: Tue, 13 Jan 2026 14:47:12 +0530 [thread overview]
Message-ID: <20260113091712.7071-1-dikshakdevgan@gmail.com> (raw)
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>
---
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 60edeae1cffe..476ab055e53e 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -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:
--
2.34.1
next reply other threads:[~2026-01-13 9:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 9:17 Diksha Kumari [this message]
2026-01-14 10:53 ` [PATCH] rtl8723bs: fix memory leak on failure path Mukesh Kumar Chaurasiya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260113091712.7071-1-dikshakdevgan@gmail.com \
--to=dikshakdevgan@gmail.com \
--cc=arend.vanspriel@broadcom.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=johannes.berg@intel.com \
--cc=knavaneeth786@gmail.com \
--cc=linux-staging@lists.linux.dev \
--cc=quic_rdevanat@quicinc.com \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox