From: Michal Nazarewicz <mina86@mina86.com>
To: Jia-Ju Bai <baijiaju1990@163.com>,
balbi@kernel.org, gregkh@linuxfoundation.org,
plr.vincent@gmail.com, felixhaedicke@web.de, jilin@nvidia.com,
dan.carpenter@oracle.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Jia-Ju Bai <baijiaju1990@163.com>
Subject: Re: [PATCH] gadget: Fix a sleep-in-atomic bug
Date: Wed, 31 May 2017 12:57:33 +0200 [thread overview]
Message-ID: <xa1tefv5qoo2.fsf@mina86.com> (raw)
In-Reply-To: <1496200423-3251-1-git-send-email-baijiaju1990@163.com>
On Wed, May 31 2017, Jia-Ju Bai wrote:
> The driver may sleep under a spin lock, and the function call path is:
> ffs_epfile_io (acquire the lock by spin_lock_irq)
> usb_ep_alloc_request(GFP_KERNEL) --> may sleep
>
> To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
> ---
> drivers/usb/gadget/function/f_fs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index 47dda34..be90e25 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -1015,7 +1015,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
> else
> ret = ep->status;
> goto error_mutex;
> - } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_KERNEL))) {
> + } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_ATOMIC))) {
> ret = -ENOMEM;
> } else {
> req->buf = data;
--
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»
prev parent reply other threads:[~2017-05-31 10:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 3:13 [PATCH] gadget: Fix a sleep-in-atomic bug Jia-Ju Bai
2017-05-31 10:57 ` Michal Nazarewicz [this message]
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=xa1tefv5qoo2.fsf@mina86.com \
--to=mina86@mina86.com \
--cc=baijiaju1990@163.com \
--cc=balbi@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=felixhaedicke@web.de \
--cc=gregkh@linuxfoundation.org \
--cc=jilin@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=plr.vincent@gmail.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