On Sat, May 22, 2021 at 1:02 AM Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > On Sat, May 22, 2021 at 12:25:19AM +0800, Dongliang Mu wrote: > > r871xu_dev_remove failed to call r8712_free_drv_sw() and free the > > resource (e.g., struct urb) due to the failure of firmware loading. > > > > Fix this by invoking r8712_free_drv_sw at the failure site. > > > > Reported-by: syzbot+1c46f3771695bccbdb3a@xxxxxxxxxxxxxxxxxxxxxxxxx > > Fixes: b4383c971bc5 ("staging: rtl8712: handle firmware load failure") > > Signed-off-by: Dongliang Mu <mudongliangabcd@xxxxxxxxx> > > --- > > v1->v2: fix the initialization of pnetdev > > > > drivers/staging/rtl8712/usb_intf.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c > > index dc21e7743349..57e773464e18 100644 > > --- a/drivers/staging/rtl8712/usb_intf.c > > +++ b/drivers/staging/rtl8712/usb_intf.c > > @@ -593,13 +593,14 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf) > > struct usb_device *udev = interface_to_usbdev(pusb_intf); > > > > if (pnetdev) { > > + struct net_device *newpnetdev = NULL; > > struct _adapter *padapter = netdev_priv(pnetdev); > > > > /* never exit with a firmware callback pending */ > > wait_for_completion(&padapter->rtl8712_fw_ready); > > - pnetdev = usb_get_intfdata(pusb_intf); > > + newpnetdev = usb_get_intfdata(pusb_intf); > > Please learn a bit more C knowledge before messing around in the kernel > tree. Between the mistake in this chunk you added, and the mistake in > the previous submission, I think you need more experience here as there > are some things you still need to learn. I am a kernel newbie in developing patches for Linux kernel. Sorry for my naive mistakes. I will learn more and then submit some "good" patches. BTW, I think I have pointed out the underlying bug here, you guys can fix it yourself. > > Best of luck! > > greg k-h