* [PATCH net] ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler
@ 2022-08-27 15:38 Duoming Zhou
2022-08-31 13:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Duoming Zhou @ 2022-08-27 15:38 UTC (permalink / raw)
To: netdev; +Cc: jiri, davem, edumazet, kuba, pabeni, linux-kernel, Duoming Zhou
The function neigh_timer_handler() is a timer handler that runs in an
atomic context. When used by rocker, neigh_timer_handler() calls
"kzalloc(.., GFP_KERNEL)" that may sleep. As a result, the sleep in
atomic context bug will happen. One of the processes is shown below:
ofdpa_fib4_add()
...
neigh_add_timer()
(wait a timer)
neigh_timer_handler()
neigh_release()
neigh_destroy()
rocker_port_neigh_destroy()
rocker_world_port_neigh_destroy()
ofdpa_port_neigh_destroy()
ofdpa_port_ipv4_neigh()
kzalloc(sizeof(.., GFP_KERNEL) //may sleep
This patch changes the gfp_t parameter of kzalloc() from GFP_KERNEL to
GFP_ATOMIC in order to mitigate the bug.
Fixes: 00fc0c51e35b ("rocker: Change world_ops API and implementation to be switchdev independant")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
---
drivers/net/ethernet/rocker/rocker_ofdpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/rocker/rocker_ofdpa.c b/drivers/net/ethernet/rocker/rocker_ofdpa.c
index bc70c6abd6a..58cf7cc54f4 100644
--- a/drivers/net/ethernet/rocker/rocker_ofdpa.c
+++ b/drivers/net/ethernet/rocker/rocker_ofdpa.c
@@ -1273,7 +1273,7 @@ static int ofdpa_port_ipv4_neigh(struct ofdpa_port *ofdpa_port,
bool removing;
int err = 0;
- entry = kzalloc(sizeof(*entry), GFP_KERNEL);
+ entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (!entry)
return -ENOMEM;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler
2022-08-27 15:38 [PATCH net] ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler Duoming Zhou
@ 2022-08-31 13:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-31 13:10 UTC (permalink / raw)
To: Duoming Zhou; +Cc: netdev, jiri, davem, edumazet, kuba, pabeni, linux-kernel
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Sat, 27 Aug 2022 23:38:15 +0800 you wrote:
> The function neigh_timer_handler() is a timer handler that runs in an
> atomic context. When used by rocker, neigh_timer_handler() calls
> "kzalloc(.., GFP_KERNEL)" that may sleep. As a result, the sleep in
> atomic context bug will happen. One of the processes is shown below:
>
> ofdpa_fib4_add()
> ...
> neigh_add_timer()
>
> [...]
Here is the summary with links:
- [net] ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler
https://git.kernel.org/netdev/net/c/c0955bf957be
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-31 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-27 15:38 [PATCH net] ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler Duoming Zhou
2022-08-31 13:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).