All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtw88: fix potential NULL pointer access for firmware
@ 2019-11-05  9:04 yhchuang
  2019-11-06 17:58 ` Kalle Valo
  2019-11-06 21:33 ` Brian Norris
  0 siblings, 2 replies; 3+ messages in thread
From: yhchuang @ 2019-11-05  9:04 UTC (permalink / raw)
  To: kvalo; +Cc: dan.carpenter, linux-wireless

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

Driver could access a NULL firmware pointer if we don't
return here.

Fixes: 5195b90426409 ("rtw88: avoid FW info flood")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 021668f1b74f..de82d08ea29e 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1024,8 +1024,10 @@ static void rtw_load_firmware_cb(const struct firmware *firmware, void *context)
 	struct rtw_fw_state *fw = &rtwdev->fw;
 	const struct rtw_fw_hdr *fw_hdr;
 
-	if (!firmware)
+	if (!firmware || !firmware->data) {
 		rtw_err(rtwdev, "failed to request firmware\n");
+		return;
+	}
 
 	fw_hdr = (const struct rtw_fw_hdr *)firmware->data;
 	fw->h2c_version = le16_to_cpu(fw_hdr->h2c_fmt_ver);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtw88: fix potential NULL pointer access for firmware
  2019-11-05  9:04 [PATCH] rtw88: fix potential NULL pointer access for firmware yhchuang
@ 2019-11-06 17:58 ` Kalle Valo
  2019-11-06 21:33 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-11-06 17:58 UTC (permalink / raw)
  To: yhchuang; +Cc: dan.carpenter, linux-wireless

<yhchuang@realtek.com> wrote:

> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
> 
> Driver could access a NULL firmware pointer if we don't
> return here.
> 
> Fixes: 5195b90426409 ("rtw88: avoid FW info flood")
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>

Patch applied to wireless-drivers-next.git, thanks.

f530c1961af2 rtw88: fix potential NULL pointer access for firmware

-- 
https://patchwork.kernel.org/patch/11227185/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtw88: fix potential NULL pointer access for firmware
  2019-11-05  9:04 [PATCH] rtw88: fix potential NULL pointer access for firmware yhchuang
  2019-11-06 17:58 ` Kalle Valo
@ 2019-11-06 21:33 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2019-11-06 21:33 UTC (permalink / raw)
  To: Tony Chuang; +Cc: Kalle Valo, Dan Carpenter, linux-wireless

On Tue, Nov 5, 2019 at 1:06 AM <yhchuang@realtek.com> wrote:
...
> Fixes: 5195b90426409 ("rtw88: avoid FW info flood")
...
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -1024,8 +1024,10 @@ static void rtw_load_firmware_cb(const struct firmware *firmware, void *context)
>         struct rtw_fw_state *fw = &rtwdev->fw;
>         const struct rtw_fw_hdr *fw_hdr;
>
> -       if (!firmware)
> +       if (!firmware || !firmware->data) {
>                 rtw_err(rtwdev, "failed to request firmware\n");

I think you still wanted 'complete_all()' here, otherwise your waiters
will hang forever. (They correctly check whether the firmware is NULL,
so that's not a problem there.)

I'll send a follow-up to the follow-up :)

Brian

> +               return;
> +       }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-06 21:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05  9:04 [PATCH] rtw88: fix potential NULL pointer access for firmware yhchuang
2019-11-06 17:58 ` Kalle Valo
2019-11-06 21:33 ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.