Re: [PATCH] staging: rtl8723bs: fix mismatched free of HalData in rtw_sdio_if1_init()

From: Dan Carpenter

Date: Thu May 28 2026 - 03:30:48 EST


On Mon, May 25, 2026 at 05:18:36PM +0800, Dawei Feng wrote:
> 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.

The rest of the commit message from HERE

> 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.

to HERE should be put

>
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
> Signed-off-by: Zilin Guan <zilin@xxxxxxxxxx>
> Signed-off-by: Dawei Feng <dawei.feng@xxxxxxxxxx>
> ---
^^^
Here under the --- cut off line. We don't need this kind of meta
commentary about testing in the permanent git log. Otherwise
the patch is correct.

regards,
dan carpenter