mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
staging: rtl8723bs: fix firmware memory leak on error
After successfully calling request_firmware(), if the firmware size check fails or if kmemdup() fails, the code jumps to the exit label without calling release_firmware(), causing a memory leak. Call release_firmware() directly in each error path before jumping to cleanup label. Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://patch.msgid.link/20260130001641.17941-2-samasth.norway.ananda@oracle.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a6fe09b40b
commit
4dba9d6c69
|
|
@ -346,12 +346,14 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw)
|
|||
|
||||
if (fw->size > FW_8723B_SIZE) {
|
||||
rtStatus = _FAIL;
|
||||
release_firmware(fw);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pFirmware->fw_buffer_sz = kmemdup(fw->data, fw->size, GFP_KERNEL);
|
||||
if (!pFirmware->fw_buffer_sz) {
|
||||
rtStatus = _FAIL;
|
||||
release_firmware(fw);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user