summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnil Kaushik <anilkaushikwireless@gmail.com>2026-10-16 09:32:23 +0000
committerPaolo Abeni <pabeni@redhat.com>2026-10-21 11:37:08 +0200
commitfe3e1a42fb7eb18d8c55d714b50a3d51f8cd6ffe (patch)
tree66876c0729327367d78b0c2ce68d1d78ae09ef2f
parent758d8928d2c5d6703da827577cef86d643155236 (diff)
gtp: hold RCU for the device lookup when adding a PDP context
gtp_genl_new_pdp() calls gtp_find_dev(), which looks the device up with dev_get_by_index_rcu(). Since commit e2d1baca2b33 ("gtp: remove useless rcu_read_lock()"), this only runs under the rtnl lock, and kernels with CONFIG_PROVE_RCU_LIST warn: WARNING: suspicious RCU usage net/core/dev.c:1047 RCU-list traversed in non-reader section!! ... dev_get_by_index_rcu gtp_find_dev gtp_genl_new_pdp Hold the RCU read lock around the lookup only: gtp_pdp_add() allocates with GFP_KERNEL, and the rtnl lock keeps the device alive afterwards. Found with the gtp selftest on a debug kernel. Fixes: e2d1baca2b33 ("gtp: remove useless rcu_read_lock()") Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com> Link: https://patch.msgid.link/20261016093225.1036375-3-anilkaushikwireless@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--drivers/net/gtp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 99836b773e5c..15b5d845fc3b 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -2050,7 +2050,10 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info)
rtnl_lock();
+ /* the rtnl lock keeps the device alive once found */
+ rcu_read_lock();
gtp = gtp_find_dev(sock_net(skb->sk), info->attrs);
+ rcu_read_unlock();
if (!gtp) {
err = -ENODEV;
goto out_unlock;