[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200623.143311.995885759487352025.davem@davemloft.net>
Date: Tue, 23 Jun 2020 14:33:11 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: likaige@...ngson.cn
Cc: benve@...co.com, _govind@....com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, lixuefeng@...ngson.cn,
yangtiezhu@...ngson.cn
Subject: Re: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in
enic_init_affinity_hint()
From: Kaige Li <likaige@...ngson.cn>
Date: Tue, 23 Jun 2020 16:13:09 +0800
> The kernel module may sleep with holding a spinlock.
>
> The function call paths (from bottom to top) are:
>
> [FUNC] zalloc_cpumask_var(GFP_KERNEL)
> drivers/net/ethernet/cisco/enic/enic_main.c, 125: zalloc_cpumask_var in enic_init_affinity_hint
> drivers/net/ethernet/cisco/enic/enic_main.c, 1918: enic_init_affinity_hint in enic_open
> drivers/net/ethernet/cisco/enic/enic_main.c, 2348: enic_open in enic_reset
> drivers/net/ethernet/cisco/enic/enic_main.c, 2341: spin_lock in enic_reset
>
> To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC.
>
> Signed-off-by: Kaige Li <likaige@...ngson.cn>
Just grepping around for GFP_KERNEL usage in atomic contexts I guess
is fine.
But you really have to look at the bigger picture.
Calling a NIC driver open function from a context holding a spinlock
is very much the real problem, so many operations have to sleep and
in face that ->ndo_open() method is defined as being allowed to sleep
and that's why the core networking never invokes it with spinlocks
held.
Powered by blists - more mailing lists