Re: [PATCH] usb: yurex: Rearrange code not to need GFP_ATOMIC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 21, 2020 at 02:24:52PM +0200, Oliver Neukum wrote:
> Am Sonntag, den 20.09.2020, 10:44 +0200 schrieb Pavel Machek:
> > Move prepare to wait around, so that normal GFP_KERNEL allocation can
> > be used.
> > 
> > Signed-off-by: Pavel Machek (CIP) <pavel@xxxxxxx>
> > Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> 
> Ehm. Please recheck.
> 
> > diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
> > index b2e09883c7e2..071f1debebba 100644
> > --- a/drivers/usb/misc/yurex.c
> > +++ b/drivers/usb/misc/yurex.c
> > @@ -489,10 +489,10 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
> >  	}
> >  
> >  	/* send the data as the control msg */
> > -	prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
> >  	dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
> >  		dev->cntl_buffer[0]);
> > -	retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
> > +	retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
> 
> URB completes here. wake_up() returns the task to RUNNING.
> 
> > +	prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
> 
> Task goes to TASK_INTERRUPTIBLE
> 
> >  	if (retval >= 0)
> >  		timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
> 
> Task turns into Sleeping Beauty until timeout
> 
> >  	finish_wait(&dev->waitq, &wait);
> 
> And here task goes into error reporting as it checks timeout.

Arrgh.  Now I feel stupid.  (Me and Pavel both, probably.)

Thanks for spotting this.

Alan Stern



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux