Re: [PATCH] gadget: Fix a sleep-in-atomic bug

2017-05-31 Thread Michal Nazarewicz
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 

Acked-by: Michal Nazarewicz 

> ---
>  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»


Re: [PATCH] gadget: Fix a sleep-in-atomic bug

2017-05-31 Thread Michal Nazarewicz
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 

Acked-by: Michal Nazarewicz 

> ---
>  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»


[PATCH] gadget: Fix a sleep-in-atomic bug

2017-05-30 Thread Jia-Ju Bai
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 
---
 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;
-- 
1.7.9.5




[PATCH] gadget: Fix a sleep-in-atomic bug

2017-05-30 Thread Jia-Ju Bai
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 
---
 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;
-- 
1.7.9.5