gtp: annotate PDP lookups under RTNL
Subsystems (3)
PATCH 1/1 gtp: annotate PDP lookups under RTNL
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.
Pass lockdep_rtnl_is_held() to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.
This was found by our static analysis tool and then manually reviewed against the current tree. The dynamic triage evidence is a target-matched CONFIG_PROVE_RCU_LIST warning; the change is limited to documenting the existing protection contract.
This is a lockdep annotation cleanup. It does not change PDP lifetime or hash updates.
--- drivers/net/gtp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/gtp.c +8 -4
@@ -151,7 +151,8 @@ static struct pdp_ctx *gtp0_pdp_find(struct gtp_dev *gtp, u64 tid, u16 family) head = >p->tid_hash[gtp0_hashfn (tid) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_tid) { +hlist_for_each_entry_rcu (pdp, head, hlist_tid, +lockdep_rtnl_is_held ()) {if (pdp->af == family && pdp->gtp_version ==GTP_V0 && pdp->u.v0.tid == tid)
@@ -168,7 +169,8 @@ static struct pdp_ctx *gtp1_pdp_find(struct gtp_dev *gtp, u32 tid, u16 family) head = >p->tid_hash[gtp1u_hashfn (tid) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_tid) { +hlist_for_each_entry_rcu (pdp, head, hlist_tid, +lockdep_rtnl_is_held ()) {if (pdp->af == family && pdp->gtp_version ==GTP_V1 && pdp->u.v1.i_tei == tid)
@@ -185,7 +187,8 @@ static struct pdp_ctx *ipv4_pdp_find(struct gtp_dev *gtp, __be32 ms_addr) head = >p->addr_hash[ipv4_hashfn (ms_addr) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_addr) { +hlist_for_each_entry_rcu (pdp, head, hlist_addr, +lockdep_rtnl_is_held ()) {if (pdp->af ==AF_INET && pdp->ms.addr.s_addr == ms_addr)return pdp;
@@ -220,7 +223,8 @@ static struct pdp_ctx *ipv6_pdp_find(struct gtp_dev *gtp, head = >p->addr_hash[ipv6_hashfn (ms_addr) % gtp->hash_size]; -hlist_for_each_entry_rcu (pdp, head, hlist_addr) { +hlist_for_each_entry_rcu (pdp, head, hlist_addr, +lockdep_rtnl_is_held ()) {if (pdp->af ==AF_INET6 &&ipv6_pdp_addr_equal (&pdp->ms.addr6, ms_addr))return pdp;
Signature · 1 line
2.34.1
Quoted 15 lines · Runyu Xiao
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.This was found by our static analysis tool and then manually reviewed against the current tree. The dynamic triage evidence is a target-matched
CONFIG_PROVE_RCU_LISTwarning; the change is limited to documenting the existing protection contract.
Quoted 4 lines
This is a lockdep annotation cleanup. It does not change PDP lifetime or hash updates.
Signed-off-by Runyu Xiao <[email protected]>
There is an AI-generated review of this patch available on sashko.dev. While I don't believe that the issues raised there should impede progress of this patch you may want to look into them as possible follow-up.
...
Pablo Neira Ayuso
maintainerHi Simon,
Quoted 19 lines · Simon Horman
Quoted 18 lines · Runyu Xiao
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.This was found by our static analysis tool and then manually reviewed against the current tree. The dynamic triage evidence is a target-matched
CONFIG_PROVE_RCU_LISTwarning; the change is limited to documenting the existing protection contract.This is a lockdep annotation cleanup. It does not change PDP lifetime or hash updates.
Quoted 7 lines
Quoted 1 line
Signed-off-by Runyu Xiao <[email protected]>Reviewed-by Simon Horman <[email protected]>There is an AI-generated review of this patch available on sashko.dev. While I don't believe that the issues raised there should impede progress of this patch you may want to look into them as possible follow-up.
This patch refers to the rtnl_lock, but it is the genetlink mutex that protects updates on the PDP context list.
Then, from packet path, rcu lookups are performed.
I think this patch is not correct.
Simon Horman
reviewerQuoted 30 lines · Pablo Neira Ayuso
Hi Simon,
Quoted 19 lines · Simon Horman
Quoted 18 lines · Runyu Xiao
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.This was found by our static analysis tool and then manually reviewed against the current tree. The dynamic triage evidence is a target-matched
CONFIG_PROVE_RCU_LISTwarning; the change is limited to documenting the existing protection contract.This is a lockdep annotation cleanup. It does not change PDP lifetime or hash updates.
Quoted 7 lines
Quoted 1 line
Signed-off-by Runyu Xiao <[email protected]>Reviewed-by Simon Horman <[email protected]>There is an AI-generated review of this patch available on sashko.dev. While I don't believe that the issues raised there should impede progress of this patch you may want to look into them as possible follow-up.
Quoted 6 lines
This patch refers to the
rtnl_lock, but it is the genetlink mutex that protects updates on the PDP context list.Then, from packet path, rcu lookups are performed.
I think this patch is not correct.
Hi Pablo,
Of course you are correct.
Sorry for not realising this earlier.
Paolo Abeni
maintainerQuoted 32 lines · Simon Horman
Quoted 31 lines · Pablo Neira Ayuso
Quoted 19 lines · Simon Horman
Quoted 18 lines · Runyu Xiao
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.This was found by our static analysis tool and then manually reviewed against the current tree. The dynamic triage evidence is a target-matched
CONFIG_PROVE_RCU_LISTwarning; the change is limited to documenting the existing protection contract.This is a lockdep annotation cleanup. It does not change PDP lifetime or hash updates.
Quoted 7 lines
Quoted 1 line
Signed-off-by Runyu Xiao <[email protected]>Reviewed-by Simon Horman <[email protected]>There is an AI-generated review of this patch available on sashko.dev. While I don't believe that the issues raised there should impede progress of this patch you may want to look into them as possible follow-up.
This patch refers to the
rtnl_lock, but it is the genetlink mutex that protects updates on the PDP context list.
Quoted 8 lines
Quoted 3 lines
Then, from packet path, rcu lookups are performed.
I think this patch is not correct.
Hi Pablo,
Of course you are correct.
Sorry for not realising this earlier.
Human slop here made me wrongly apply this patch. Could either of you please share a formal revert?
Thanks!
Paolo
Simon Horman
reviewerQuoted 37 lines · Paolo Abeni
Quoted 36 lines · Simon Horman
Quoted 34 lines · Pablo Neira Ayuso
Quoted 19 lines · Simon Horman
Quoted 18 lines · Runyu Xiao
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.This was found by our static analysis tool and then manually reviewed against the current tree. The dynamic triage evidence is a target-matched
CONFIG_PROVE_RCU_LISTwarning; the change is limited to documenting the existing protection contract.This is a lockdep annotation cleanup. It does not change PDP lifetime or hash updates.
Quoted 7 lines
Quoted 1 line
Signed-off-by Runyu Xiao <[email protected]>Reviewed-by Simon Horman <[email protected]>There is an AI-generated review of this patch available on sashko.dev. While I don't believe that the issues raised there should impede progress of this patch you may want to look into them as possible follow-up.
This patch refers to the
rtnl_lock, but it is the genetlink mutex that protects updates on the PDP context list.Then, from packet path, rcu lookups are performed.
I think this patch is not correct.
Quoted 7 lines
Quoted 4 lines
Hi Pablo,
Of course you are correct.
Sorry for not realising this earlier.Human slop here made me wrongly apply this patch. Could either of you please share a formal revert?
Sure, will do.
Simon Horman
reviewerQuoted 3 lines · Simon Horman
Quoted 2 lines · Paolo Abeni
Quoted 1 line · Simon Horman
On Tue, Jul 07, 2026 at 04:51:12PM +0200, Pablo Neira Ayuso wrote:
...
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
I think this patch is not correct.
Hi Pablo,
Of course you are correct.
Sorry for not realising this earlier.Human slop here made me wrongly apply this patch. Could either of you please share a formal revert?
Sure, will do.
- [PATCH net-next] Revert "gtp: annotate PDP lookups under RTNL"
https://lore.kernel.org/netdev/[email protected]/T/
Paolo Abeni
maintainerQuoted 14 lines · Simon Horman
Quoted 3 lines · Simon Horman
Quoted 2 lines · Paolo Abeni
Quoted 1 line · Simon Horman
On Tue, Jul 07, 2026 at 04:51:12PM +0200, Pablo Neira Ayuso wrote:
...
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
I think this patch is not correct.
Hi Pablo,
Of course you are correct.
Sorry for not realising this earlier.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Human slop here made me wrongly apply this patch. Could either of you please share a formal revert?
Sure, will do.
- [PATCH net-next] Revert "gtp: annotate PDP lookups under RTNL"
https://lore.kernel.org/netdev/[email protected]/T/
Thanks Simon!
/P
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 11 lines · On Wed, 1 Jul 2026 20:39:25 +0800 you wrote:
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.[...]
Here is the summary with links:
- [net-next] gtp: annotate PDP lookups under RTNL
https://git.kernel.org/netdev/net-next/c/0be5c3f0fbef
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Pablo Neira Ayuso
maintainerHi,
Quoted 16 lines · On Wed, Jul 08, 2026 at 08:20:09AM +0000, [email protected]…
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Wed, 1 Jul 2026 20:39:25 +0800 you wrote:
The GTP PDP lookup helpers are shared by RCU-protected data and report paths and RTNL-protected control paths such as
gtp_genl_new_pdp(). The helpers walk RCU hlists, but they do not currently pass the RTNL condition for the control-path lookups.Pass
lockdep_rtnl_is_held()to the PDP hlist iterators. Existing RCU-reader callers remain valid because the RCU-list macros also accept an active RCU read-side section; the added condition only documents the non-RCU protection already used by RTNL control paths.
Quoted 5 lines
Quoted 1 line
[...]
Here is the summary with links:
- [net-next] gtp: annotate PDP lookups under RTNLhttps://git.kernel.org/netdev/net-next/c/0be5c3f0fbef
For the record, I think this patch was not OK.
PDP context hashtable is protected by the genl_mutex, not rtnl.
If I'm mistaken, please let know, thanks!