linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: Zheng Hacker <hackerzheng666@gmail.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	Zheng Wang <zyytlz.wz@163.com>,
	"valentina.manea.m@gmail.com" <valentina.manea.m@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"1395428693sheep@gmail.com" <1395428693sheep@gmail.com>,
	"alex000young@gmail.com" <alex000young@gmail.com>
Subject: Re: [PATCH v2] usbip: vudc: Fix use after free bug in vudc_remove due to race condition
Date: Thu, 16 Mar 2023 20:09:51 +0100	[thread overview]
Message-ID: <ZBNpf5X+y26+eKYf@kroah.com> (raw)
In-Reply-To: <CAJedcCyb_XP=X=2XzjKJ-ay=mzPdEJEdRsAcU2KbeaQPjLaW3g@mail.gmail.com>

On Fri, Mar 17, 2023 at 02:27:05AM +0800, Zheng Hacker wrote:
> 在 2023年3月17日星期五,Shuah Khan <skhan@linuxfoundation.org> 写道:
> 
> > On 3/16/23 12:09, 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.
> >>
> >> 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
> >>
> >> This bug was found by static analysis.
> >>
> >
> > Tell me which static analysis tool did you use to find this and
> > the output from the tool.
> 
> 
>      This is found by codeql,the rule is complicated. It     finally found
> there is no timer stop behavior in remove function.

When using tools like this, you are required to follow the rules in
Documentation/process/researcher-guidelines.rst

Please do so here.

thanks,

greg k-h

  parent reply	other threads:[~2023-03-16 19:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 18:09 [PATCH v2] usbip: vudc: Fix use after free bug in vudc_remove due to race condition Zheng Wang
2023-03-16 18:18 ` Shuah Khan
     [not found]   ` <CAJedcCyb_XP=X=2XzjKJ-ay=mzPdEJEdRsAcU2KbeaQPjLaW3g@mail.gmail.com>
2023-03-16 19:09     ` gregkh [this message]
2023-03-17  3:59       ` Zheng Hacker
2023-03-16 23:08 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBNpf5X+y26+eKYf@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=1395428693sheep@gmail.com \
    --cc=alex000young@gmail.com \
    --cc=hackerzheng666@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=valentina.manea.m@gmail.com \
    --cc=zyytlz.wz@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).