lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 31 May 2017 12:57:33 +0200
From:   Michal Nazarewicz <mina86@...a86.com>
To:     Jia-Ju Bai <baijiaju1990@....com>, balbi@...nel.org,
        gregkh@...uxfoundation.org, plr.vincent@...il.com,
        felixhaedicke@....de, jilin@...dia.com, dan.carpenter@...cle.com
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jia-Ju Bai <baijiaju1990@....com>
Subject: Re: [PATCH] gadget: Fix a sleep-in-atomic bug

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@....com>

Acked-by: Michal Nazarewicz <mina86@...a86.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»

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ