lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJedcCye9HsDBrao=VEsN=qxkV3HCmGPTix3g8BL+K6oCCaE=w@mail.gmail.com>
Date:   Fri, 17 Mar 2023 02:03:15 +0800
From:   Zheng Hacker <hackerzheng666@...il.com>
To:     Shuah Khan <skhan@...uxfoundation.org>
Cc:     Zheng Wang <zyytlz.wz@....com>, valentina.manea.m@...il.com,
        shuah@...nel.org, gregkh@...uxfoundation.org,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        1395428693sheep@...il.com, alex000young@...il.com
Subject: Re: [PATCH RESEND] usbip: vudc: Fix use after free bug in vudc_remove
 due to race condition

Shuah Khan <skhan@...uxfoundation.org> 于2023年3月17日周五 01:59写道:
>
> On 3/16/23 11:48, Zheng Wang wrote:
> > In vudc_probe, it calls init_vudc_hw, which bound &udc->timer with v_timer.
> >
> > When it calls usbip_sockfd_store, it will call v_start_timer to start the
> > timer work.
> >
> > When we call vudc_remove to remove the driver, theremay be a sequence as
> > follows:
> >
> > Fix it by shutdown the timer work before cleanup in vudc_remove.
> >
>
> Send me v2 for this patch with adding details on how you found this problem
> to this commit log.
>

Get it, I found it by static analysis. So this might be false postive.
Will add this
to next version of patch

Best regards,
Zheng

> > Note that removing a driver is a root-only operation, and should never
> > happen.
> >
> > CPU0                  CPU1
> >
> >                       |v_timer
> > vudc_remove          |
> > kfree(udc);          |
> > //free shost         |
> >                       |udc->gadget
> >                       |//use
> >
> > Fixes: b6a0ca111867 ("usbip: vudc: Add UDC specific ops")
> > Signed-off-by: Zheng Wang <zyytlz.wz@....com>
> > ---
> >   drivers/usb/usbip/vudc_dev.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c
> > index 2bc428f2e261..33d0991755bb 100644
> > --- a/drivers/usb/usbip/vudc_dev.c
> > +++ b/drivers/usb/usbip/vudc_dev.c
> > @@ -633,6 +633,7 @@ int vudc_remove(struct platform_device *pdev)
> >   {
> >       struct vudc *udc = platform_get_drvdata(pdev);
> >
> > +     timer_shutdown_sync(&udc->timer);
> >       usb_del_gadget_udc(&udc->gadget);
> >       cleanup_vudc_hw(udc);
> >       kfree(udc);
>
> thanks,
> -- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ