diff mbox series

[net] netpoll: guard __netpoll_send_skb() with RCU read lock

Message ID 20250303-netpoll_rcu_v2-v1-1-6b34d8a01fa2@debian.org (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net] netpoll: guard __netpoll_send_skb() with RCU read lock | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-03-03--18-00 (tests: 893)

Commit Message

Breno Leitao March 3, 2025, 11:44 a.m. UTC
The function __netpoll_send_skb() is being invoked without holding the
RCU read lock. This oversight triggers a warning message when
CONFIG_PROVE_RCU_LIST is enabled:

	net/core/netpoll.c:330 suspicious rcu_dereference_check() usage!

	 netpoll_send_skb
	 netpoll_send_udp
	 write_ext_msg
	 console_flush_all
	 console_unlock
	 vprintk_emit

To prevent npinfo from disappearing unexpectedly, ensure that
__netpoll_send_skb() is protected with the RCU read lock.

Fixes: 2899656b494dcd1 ("netpoll: take rcu_read_lock_bh() in netpoll_send_skb_on_dev()")
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 net/core/netpoll.c | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: 7eb172143d5508b4da468ed59ee857c6e5e01da6
change-id: 20250303-netpoll_rcu_v2-fed72eb0cb83

Best regards,
diff mbox series

Patch

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 62b4041aae1ae..cac389105e2d1 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -326,6 +326,7 @@  static netdev_tx_t __netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
 
 	lockdep_assert_irqs_disabled();
 
+	guard(rcu)();
 	dev = np->dev;
 	npinfo = rcu_dereference_bh(dev->npinfo);