From: Dawei Feng <dawei.feng@seu.edu.cn>
To: gregkh@linuxfoundation.org
Cc: error27@gmail.com, omer.e.idrissi@gmail.com, hansg@kernel.org,
hi@josie.lol, straube.linux@gmail.com, xela@viard.dev,
ethantidmore06@gmail.com, liangjie@lixiang.com,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
jianhao.xu@seu.edu.cn, Dawei Feng <dawei.feng@seu.edu.cn>,
Zilin Guan <zilin@seu.edu.cn>
Subject: [PATCH] staging: rtl8723bs: fix mismatched free of HalData in rtw_sdio_if1_init()
Date: Mon, 25 May 2026 17:18:36 +0800 [thread overview]
Message-ID: <20260525091836.812565-1-dawei.feng@seu.edu.cn> (raw)
padapter->HalData is allocated via vzalloc(), but incorrectly freed
using kfree() in the rtw_sdio_if1_init() error path. Using kfree() to
release this vmalloc-backed buffer can lead to memory corruption.
Use rtw_hal_data_deinit() to pair the free correctly and free
HalData with vfree().
The bug was first flagged by an experimental static analysis tool we
are developing for kernel memory-management bugs. Manual inspection
confirms that the issue is still present in current mainline.
An x86_64 allyesconfig build showed no new warnings. As we do not have
suitable RTL8723BS SDIO hardware to test with, no runtime testing was
able to be performed.
Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
---
drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d0feb28b7043..67ef0e1271b0 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -287,8 +287,8 @@ static struct adapter *rtw_sdio_if1_init(struct dvobj_priv *dvobj, const struct
status = _SUCCESS;
free_hal_data:
- if (status != _SUCCESS && padapter->HalData)
- kfree(padapter->HalData);
+ if (status != _SUCCESS)
+ rtw_hal_data_deinit(padapter);
if (status != _SUCCESS) {
rtw_wdev_unregister(padapter->rtw_wdev);
--
2.34.1
next reply other threads:[~2026-05-25 9:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 9:18 Dawei Feng [this message]
2026-05-28 7:30 ` Dan Carpenter
2026-05-28 10:15 ` Dawei Feng
2026-05-28 10:35 ` Dan Carpenter
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=20260525091836.812565-1-dawei.feng@seu.edu.cn \
--to=dawei.feng@seu.edu.cn \
--cc=error27@gmail.com \
--cc=ethantidmore06@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=hi@josie.lol \
--cc=jianhao.xu@seu.edu.cn \
--cc=liangjie@lixiang.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=omer.e.idrissi@gmail.com \
--cc=straube.linux@gmail.com \
--cc=xela@viard.dev \
--cc=zilin@seu.edu.cn \
/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
all inboxes | Powered by JetHome®