[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAeHK+w3hUbNO5PBcoZX2cJsmRPZ8bq+8j8-Xs7nZLFyKbdd+A@mail.gmail.com>
Date: Tue, 6 Oct 2020 17:44:33 +0200
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Shuah Khan <skhan@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Valentina Manea <valentina.manea.m@...il.com>,
Shuah Khan <shuah@...nel.org>,
USB list <linux-usb@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Nazime Hande Harputluoglu <handeharputlu@...gle.com>,
syzkaller <syzkaller@...glegroups.com>
Subject: Re: Is usb_hcd_giveback_urb() allowed in task context?
On Tue, Oct 6, 2020 at 3:23 AM Alan Stern <stern@...land.harvard.edu> wrote:
>
> On Mon, Oct 05, 2020 at 05:38:22PM -0600, Shuah Khan wrote:
> > On 10/5/20 9:25 AM, Alan Stern wrote:
> > > On Mon, Oct 05, 2020 at 05:21:30PM +0200, Andrey Konovalov wrote:
> > > No, no -- it won't work right if it's called in process context. Not
> > > only do the spinlock calls leave the interrupt flag unchanged, also the
> > > driver callback routines may expect to be invoked with interrupts
> > > disabled. (We have tried to fix this, but I'm not at all certain that
> > > all the cases have been updated.)
> > >
> >
> > In the case of vhci case, usb_hcd_giveback_urb() is called from vhci's
> > urb_enqueue, when it determines it doesn't need to xmit the urb and can give
> > it back. This path runs in task context.
> >
> > Do you have any recommendation on how this case can be handled?
>
> Just call local_irq_disable() before usb_hcd_giveback_urb(), and
> local_irq_enable() afterward.
OK, so overall it's possible to call usb_hcd_giveback_urb() in task
context, but only with irqs disabled.
This means we do need a fix for kcov as well, thank you!
Powered by blists - more mailing lists