2022-04-16 01:58:32

by Wang Cheng

[permalink] [raw]
Subject: Re: [PATCH] staging: rtl8712: fix uninit-value "data" and "mac"

On 22/04/14 11:12PM, Pavel Skripkin wrote:
> Hi Wang,
>
> On 4/14/22 17:12, Wang Cheng wrote:
> > Due to the case that "requesttype == 0x01 && status <= 0"
> > isn't handled in r8712_usbctrl_vendorreq(),
> > "data" (drivers/staging/rtl8712/usb_ops.c:32)
> > will be returned without initialization.
> >
> > When "tmpU1b" (drivers/staging/rtl8712/usb_intf.c:395)
> > is 0, mac[6] (usb_intf.c:394) won't be initialized,
> > which leads to accessing uninit-value on usb_intf.c:541.
> >
> > Reported-and-tested-by: [email protected]
> > Signed-off-by: Wang Cheng <[email protected]>
>
> This patch will just hide the problematic API in that driver. Correct fix is
> changing usb_control_msg to usb_control_msg_{recv,send}.
>
> IIRC this driver does not want read various length requests, so it should be
> fine

Hi Pavel, thx for your review.

Sorry, this patch is just confined to fixing uninit-values with
modifying the original code as less as possible. It sounds good to
refactor r8712_usbctrl_vendorreq() with better API.

thanks,
-- w

>
>
>
>
> With regards,
> Pavel Skripkin


2022-04-18 08:28:52

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH] staging: rtl8712: fix uninit-value "data" and "mac"

Hi Wang,

On 4/15/22 12:57, Wang Cheng wrote:
> Hi Pavel, thx for your review.
>
> Sorry, this patch is just confined to fixing uninit-values with
> modifying the original code as less as possible. It sounds good to
> refactor r8712_usbctrl_vendorreq() with better API.
>

I understand your idea, but this will just hide the real problem until
syzbot hit it in different place. So, I believe, it's better to fix the
root case instead of hiding local cases.




With regards,
Pavel Skripkin

2022-04-18 09:01:40

by Wang Cheng

[permalink] [raw]
Subject: Re: [PATCH] staging: rtl8712: fix uninit-value "data" and "mac"

On 22/04/16 01:57PM, Pavel Skripkin wrote:
> Hi Wang,
>
> On 4/15/22 12:57, Wang Cheng wrote:
> > Hi Pavel, thx for your review.
> >
> > Sorry, this patch is just confined to fixing uninit-values with
> > modifying the original code as less as possible. It sounds good to
> > refactor r8712_usbctrl_vendorreq() with better API.
> >
>
> I understand your idea, but this will just hide the real problem until
> syzbot hit it in different place. So, I believe, it's better to fix the root
> case instead of hiding local cases.

Of course, I agree on fixing the root case. I will think about replacing
APIs properly.

thanks,
- w