pppoe: delete session hash entries by pointer match
Subsystems (4)
PATCH 1/1 pppoe: delete session hash entries by pointer match
pppoe_connect() copies the requested PPPoE address to a socket before attempting to insert the socket into the session hash table. If the tuple already exists, __set_item() returns -EALREADY, but the copied address and ifindex remain set on the failed socket.
Closing that socket then deletes the existing socket's hash entry through pppoe_release(), preventing it from receiving further session traffic. An unprivileged process in the same network namespace can trigger this through a duplicate connection attempt.
To avoid the accidental delete, pass the pppox_sock to __delete_item(), and unlink only an entry whose pointer matches the requested socket.
--- drivers/net/ppp/pppoe.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
drivers/net/ppp/pppoe.c +8 -14
@@ -194,18 +194,16 @@ static int __set_item(struct pppoe_net *pn, struct pppox_sock *po)return 0 ; } -static void __delete_item (struct pppoe_net *pn,__be16 sid, -char *addr,int ifindex) +static void __delete_item (struct pppoe_net *pn,const struct pppox_sock *po) { -int hash =hash_item (sid, addr); +int hash =hash_item (po->pppoe_pa.sid, po->pppoe_pa.remote);struct pppox_sock *ret,__rcu **src; ret =rcu_dereference_protected (pn->hash_table[hash],lockdep_is_held (&pn->hash_lock)); src = &pn->hash_table[hash];while (ret) { -if (cmp_addr (&ret->pppoe_pa, sid, addr) && - ret->pppoe_ifindex == ifindex) { +if (ret == po) {struct pppox_sock *next; next = rcu_dereference_protected(ret->next,
@@ -236,11 +234,10 @@ static inline struct pppox_sock *get_item(struct pppoe_net *pn, __be16 sid,return po; } -static inline void delete_item (struct pppoe_net *pn,__be16 sid, -char *addr,int ifindex) +static void delete_item (struct pppoe_net *pn,const struct pppox_sock *po) {spin_lock (&pn->hash_lock); -__delete_item (pn, sid, addr, ifindex); +__delete_item (pn, po);spin_unlock (&pn->hash_lock); }
@@ -570,8 +567,7 @@ static int pppoe_release(struct socket *sock)* protect "po" from concurrent updates * on pppoe_flush_dev */ -delete_item (pn, po->pppoe_pa.sid, po->pppoe_pa.remote, - po->pppoe_ifindex); +delete_item (pn, po);sock_orphan (sk); sock->sk =NULL ;
@@ -621,8 +617,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr_unsized *uservaddrif (stage_session (po->pppoe_pa.sid)) {pppox_unbind_sock (sk); pn =pppoe_pernet (sock_net (sk)); -delete_item (pn, po->pppoe_pa.sid, - po->pppoe_pa.remote, po->pppoe_ifindex); +delete_item (pn, po);if (po->pppoe_dev) {dev_put (po->pppoe_dev); po->pppoe_dev =NULL ;
@@ -672,8 +667,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr_unsized *uservaddr error =ppp_register_net_channel (dev_net (dev), &po->chan);if (error) { -delete_item (pn, po->pppoe_pa.sid, - po->pppoe_pa.remote, po->pppoe_ifindex); +delete_item (pn, po); goto err_put; }
Signature · 1 line
2.43.0
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Quoted 8 lines · On 2026/10/20 17:24, [email protected] wrote:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
This was found by LLM when generating selftests.
Quoted 4 lines
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
It was triggered by a duplicate connection attempt in a generated selftest, breaking the existing connection.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Tue, 20 Oct 2026 17:21:11 +0800 you wrote:
pppoe_connect()copies the requested PPPoE address to a socket before attempting to insert the socket into the session hash table. If the tuple already exists,__set_item()returns-EALREADY, but the copied address and ifindex remain set on the failed socket.Closing that socket then deletes the existing socket's hash entry through
pppoe_release(), preventing it from receiving further session traffic. An unprivileged process in the same network namespace can trigger this through a duplicate connection attempt.[...]
Here is the summary with links:
- [net] pppoe: delete session hash entries by pointer match
https://git.kernel.org/netdev/net/c/b5b8c81836e2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html