diff mbox series

staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context.

Message ID 1554641923-11503-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp (mailing list archive)
State Not Applicable
Delegated to: Johannes Berg
Headers show
Series staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context. | expand

Commit Message

Tetsuo Handa April 7, 2019, 12:58 p.m. UTC
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 <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: e624c58cf8eb5116 ("staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global")
Cc: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/staging/wilc1000/wilc_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adham Abozaeid April 8, 2019, 9:13 p.m. UTC | #1
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 <penguin-kernel@I-love.SAKURA.ne.jp>
> Fixes: e624c58cf8eb5116 ("staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global")
> Cc: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Adham Abozaeid <adham.abozaeid@microchip.com>

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;
>
Greg KH April 16, 2019, 11:15 a.m. UTC | #2
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 <penguin-kernel@I-love.SAKURA.ne.jp>
> 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
diff mbox series

Patch

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;