diff mbox series

wifi: rtw89: uninitialized variable on error in rtw89_early_fw_feature_recognize()

Message ID YyMzDtX/3fUBnonC@kili (mailing list archive)
State Accepted
Commit 4c3140f4cea66b06e4a982e0c2f7b7d113040b26
Delegated to: Kalle Valo
Headers show
Series wifi: rtw89: uninitialized variable on error in rtw89_early_fw_feature_recognize() | expand

Commit Message

Dan Carpenter Sept. 15, 2022, 2:13 p.m. UTC
If request_partial_firmware_into_buf() fails then "firmware" is not
initialized and the release_firmware(firmware) will crash.

Fixes: deebea35d699 ("wifi: rtw89: early recognize FW feature to decide if chanctx")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/realtek/rtw89/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ping-Ke Shih Sept. 16, 2022, 12:24 a.m. UTC | #1
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Thursday, September 15, 2022 10:14 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; Kevin Yang <kevin_yang@realtek.com>
> Cc: Kalle Valo <kvalo@kernel.org>; Kevin Yang <kevin_yang@realtek.com>; linux-wireless@vger.kernel.org;
> kernel-janitors@vger.kernel.org
> Subject: [PATCH] wifi: rtw89: uninitialized variable on error in rtw89_early_fw_feature_recognize()
> 
> If request_partial_firmware_into_buf() fails then "firmware" is not
> initialized and the release_firmware(firmware) will crash.
> 
> Fixes: deebea35d699 ("wifi: rtw89: early recognize FW feature to decide if chanctx")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Thank you.

> ---
>  drivers/net/wireless/realtek/rtw89/fw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
> index 8e4d0e18fa71..2be70b907762 100644
> --- a/drivers/net/wireless/realtek/rtw89/fw.c
> +++ b/drivers/net/wireless/realtek/rtw89/fw.c
> @@ -268,7 +268,7 @@ void rtw89_early_fw_feature_recognize(struct device *device,
>  						device, &buf, sizeof(buf), 0);
>  	if (ret) {
>  		dev_err(device, "failed to early request firmware: %d\n", ret);
> -		goto out;
> +		return;
>  	}
> 
>  	ver_code = buf.mfw_hdr.sig != RTW89_MFW_SIG ?
> --
> 2.35.1
> 
> 
> ------Please consider the environment before printing this e-mail.
Kalle Valo Sept. 19, 2022, 10:09 a.m. UTC | #2
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> If request_partial_firmware_into_buf() fails then "firmware" is not
> initialized and the release_firmware(firmware) will crash.
> 
> Fixes: deebea35d699 ("wifi: rtw89: early recognize FW feature to decide if chanctx")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

4c3140f4cea6 wifi: rtw89: uninitialized variable on error in rtw89_early_fw_feature_recognize()
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 8e4d0e18fa71..2be70b907762 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -268,7 +268,7 @@  void rtw89_early_fw_feature_recognize(struct device *device,
 						device, &buf, sizeof(buf), 0);
 	if (ret) {
 		dev_err(device, "failed to early request firmware: %d\n", ret);
-		goto out;
+		return;
 	}
 
 	ver_code = buf.mfw_hdr.sig != RTW89_MFW_SIG ?