Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 65d4fc7

Browse files
Sebastian Andrzej Siewiorgregkh
Sebastian Andrzej Siewior
authored andcommitted
sfc: Don't invoke xdp_do_flush() from netpoll.
[ Upstream commit 55e8024 ] Yury reported a crash in the sfc driver originated from netpoll_send_udp(). The netconsole sends a message and then netpoll invokes the driver's NAPI function with a budget of zero. It is dedicated to allow driver to free TX resources, that it may have used while sending the packet. In the netpoll case the driver invokes xdp_do_flush() unconditionally, leading to crash because bpf_net_context was never assigned. Invoke xdp_do_flush() only if budget is not zero. Fixes: 401cb7d ("net: Reference bpf_redirect_info via task_struct on PREEMPT_RT.") Reported-by: Yury Vostrikov <mon@unformed.ru> Closes: https://lore.kernel.org/5627f6d1-5491-4462-9d75-bc0612c26a22@app.fastmail.com Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com> Link: https://patch.msgid.link/20241002125837.utOcRo6Y@linutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e3f2de3 commit 65d4fc7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/net/ethernet/sfc/efx_channels.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,8 @@ static int efx_poll(struct napi_struct *napi, int budget)
12601260

12611261
spent = efx_process_channel(channel, budget);
12621262

1263-
xdp_do_flush();
1263+
if (budget)
1264+
xdp_do_flush();
12641265

12651266
if (spent < budget) {
12661267
if (efx_channel_has_rx_queue(channel) &&

drivers/net/ethernet/sfc/siena/efx_channels.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,8 @@ static int efx_poll(struct napi_struct *napi, int budget)
12851285

12861286
spent = efx_process_channel(channel, budget);
12871287

1288-
xdp_do_flush();
1288+
if (budget)
1289+
xdp_do_flush();
12891290

12901291
if (spent < budget) {
12911292
if (efx_channel_has_rx_queue(channel) &&

0 commit comments

Comments
 (0)