2019-04-07 12:59:01

by Tetsuo Handa

[permalink] [raw]
Subject: [PATCH] staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context.

Since wilc_set_multicast_list() is called with dev->addr_list_lock
spinlock held, we can't use GFP_KERNEL memory allocation.

Signed-off-by: Tetsuo Handa <[email protected]>
Fixes: e624c58cf8eb5116 ("staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global")
Cc: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wilc_netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_netdev.c b/drivers/staging/wilc1000/wilc_netdev.c
index 1787154..ba78c08 100644
--- a/drivers/staging/wilc1000/wilc_netdev.c
+++ b/drivers/staging/wilc1000/wilc_netdev.c
@@ -708,7 +708,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
return;
}

- mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_KERNEL);
+ mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_ATOMIC);
if (!mc_list)
return;

--
1.8.3.1



2019-04-08 21:14:04

by Adham Abozaeid

[permalink] [raw]
Subject: Re: [PATCH] staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context.


On 4/7/19 5:58 AM, Tetsuo Handa wrote:
> Since wilc_set_multicast_list() is called with dev->addr_list_lock
> spinlock held, we can't use GFP_KERNEL memory allocation.
>
> Signed-off-by: Tetsuo Handa <[email protected]>
> Fixes: e624c58cf8eb5116 ("staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global")
> Cc: Ajay Singh <[email protected]>
Reviewed-by: Adham Abozaeid <[email protected]>

Thanks,
Adham

> ---
> drivers/staging/wilc1000/wilc_netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/wilc_netdev.c b/drivers/staging/wilc1000/wilc_netdev.c
> index 1787154..ba78c08 100644
> --- a/drivers/staging/wilc1000/wilc_netdev.c
> +++ b/drivers/staging/wilc1000/wilc_netdev.c
> @@ -708,7 +708,7 @@ static void wilc_set_multicast_list(struct net_device *dev)
> return;
> }
>
> - mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_KERNEL);
> + mc_list = kmalloc_array(dev->mc.count, ETH_ALEN, GFP_ATOMIC);
> if (!mc_list)
> return;
>

2019-04-16 11:48:14

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context.

On Sun, Apr 07, 2019 at 09:58:43PM +0900, Tetsuo Handa wrote:
> Since wilc_set_multicast_list() is called with dev->addr_list_lock
> spinlock held, we can't use GFP_KERNEL memory allocation.
>
> Signed-off-by: Tetsuo Handa <[email protected]>
> Fixes: e624c58cf8eb5116 ("staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global")

No need for so many sha1 characters, this is the canonical length to
use:
e624c58cf8eb
thanks,

greg k-h