All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Felipe Balbi <balbi@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	USB mailing list <linux-usb@vger.kernel.org>,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] USB: gadget: Fix use-after-free Read in usb_udc_uevent()
Date: Thu, 11 Aug 2022 12:06:06 -0400	[thread overview]
Message-ID: <YvUo7ukc8xKxKLZt@rowland.harvard.edu> (raw)
In-Reply-To: <febf579a-6451-1dc6-b583-0ba1a76344a6@samsung.com>

On Thu, Aug 11, 2022 at 09:31:34AM +0200, Marek Szyprowski wrote:
> Hi Alan,
> 
> On 10.08.2022 21:33, Alan Stern wrote:
> > On Mon, Aug 08, 2022 at 04:26:49PM -0400, Alan Stern wrote:
> >> On Mon, Aug 08, 2022 at 04:57:35PM +0200, Marek Szyprowski wrote:
> >>> This patch landed recently in linux-next as commit 2191c00855b0 ("USB:
> >>> gadget: Fix use-after-free Read in usb_udc_uevent()"). Unfortunately it
> >>> fixes the issue by introducing another one. It doesn't look very
> >>> probable, but it would be nice to fix it to make the lock dependency
> >>> checker happy.
> >> Indeed.
> >> I suspect the problem is that udc_lock is held for too long.  Probably it
> >> should be released during the calls to udc->driver->bind and
> >> udc->driver->unbind.
> >>
> >> Getting this right will require some careful study.  Marek, if I send you
> >> a patch later, will you be able to test it?
> > Here's a patch for you to try, when you have the chance.  It reduces the
> > scope of udc_lock to cover only the fields it's supposed to protect and
> > changes the locking in a few other places.
> >
> > There's still the possibility of a locking cycle, because udc_lock is
> > held in the ->disconnect pathway.  It's very hard to know whether that
> > might cause any trouble; it depends on how the function drivers handle
> > disconnections.
> 
> It looks this fixed the issue I've reported. I've checked it on all my 
> test systems and none reported any issue related to the udc.
> 
> Feel free to add:
> 
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> 
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

Thanks for the quick testing.  I'll submit the patch when the current 
merge window ends.

Alan Stern

  reply	other threads:[~2022-08-11 16:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 13:21 KASAN: use-after-free Read in usb_udc_uevent syzbot
2022-07-20 18:03 ` [syzbot] " syzbot
2022-07-21 13:58   ` Alan Stern
2022-07-21 14:26     ` syzbot
2022-07-21 15:07       ` [PATCH] USB: gadget: Fix use-after-free Read in usb_udc_uevent() Alan Stern
2022-07-27 12:17         ` Greg KH
2022-08-08 14:57         ` Marek Szyprowski
2022-08-08 20:26           ` Alan Stern
2022-08-09  6:29             ` Marek Szyprowski
2022-08-10 19:33             ` Alan Stern
2022-08-11  7:31               ` Marek Szyprowski
2022-08-11 16:06                 ` Alan Stern [this message]
2022-08-26  6:30                   ` Marek Szyprowski
2022-08-26 14:50                     ` Alan Stern
2022-09-01 19:22               ` Francesco Dolcini
2022-09-01 19:29                 ` Alan Stern

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=YvUo7ukc8xKxKLZt@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=peterz@infradead.org \
    --cc=syzkaller-bugs@googlegroups.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 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.