public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"mina86@mina86.com" <mina86@mina86.com>,
	"lars@metafoo.de" <lars@metafoo.de>,
	"balbi@kernel.org" <balbi@kernel.org>
Subject: Re: [PATCH] usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags
Date: Thu, 16 Jan 2020 11:13:42 +0000	[thread overview]
Message-ID: <f3f8e2a6480da78ba23ddedb68beee71f47e178f.camel@analog.com> (raw)
In-Reply-To: <20191106120219.15028-1-alexandru.ardelean@analog.com>

On Wed, 2019-11-06 at 14:02 +0200, Alexandru Ardelean wrote:
> From: Lars-Peter Clausen <lars@metafoo.de>
> 
> ffs_aio_cancel() can be called from both interrupt and thread context.
> Make
> sure that the current IRQ state is saved and restored by using
> spin_{un,}lock_irq{save,restore}().
> 
> Otherwise undefined behavior might occur.

Hey,

This is a patch-ping.

Thanks
Alex

> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/usb/gadget/function/f_fs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_fs.c
> b/drivers/usb/gadget/function/f_fs.c
> index 59d9d512dcda..ed3bcbb84b95 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -1160,18 +1160,19 @@ static int ffs_aio_cancel(struct kiocb *kiocb)
>  {
>  	struct ffs_io_data *io_data = kiocb->private;
>  	struct ffs_epfile *epfile = kiocb->ki_filp->private_data;
> +	unsigned long flags;
>  	int value;
>  
>  	ENTER();
>  
> -	spin_lock_irq(&epfile->ffs->eps_lock);
> +	spin_lock_irqsave(&epfile->ffs->eps_lock, flags);
>  
>  	if (likely(io_data && io_data->ep && io_data->req))
>  		value = usb_ep_dequeue(io_data->ep, io_data->req);
>  	else
>  		value = -EINVAL;
>  
> -	spin_unlock_irq(&epfile->ffs->eps_lock);
> +	spin_unlock_irqrestore(&epfile->ffs->eps_lock, flags);
>  
>  	return value;
>  }

  reply	other threads:[~2020-01-16 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 12:02 [PATCH] usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags Alexandru Ardelean
2020-01-16 11:13 ` Ardelean, Alexandru [this message]
2020-01-16 13:04   ` Felipe Balbi
2020-01-16 13:05     ` Ardelean, Alexandru
2020-01-16 13:29 ` [PATCH][RESEND] " Alexandru Ardelean
2020-01-18 13:18   ` Michał Nazarewicz

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=f3f8e2a6480da78ba23ddedb68beee71f47e178f.camel@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.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