Subject: [RFC PATCH net-next] pppoe: drop getsockname() syscall

From: Qingfang Deng <[email-masked]>
Date: Wed, 15 Apr 2026 17:16:12 +0800

The getsockname syscall is not used by pppd. It also has two flaws:
1. It does not hold the socket lock, so if the struct is being changed
   in pppoe_connect() simultaneously, it may see partial updates.
2. If the lower network device is renamed, this operation still returns
   the original name.

Given it is unused and buggy, remove the syscall.

Signed-off-by: Qingfang Deng <[email-masked]>
---
Note: sent as RFC, since net-next is closed.

 drivers/net/ppp/pppoe.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index d546a7af0d54..0d64a16715e2 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -688,22 +688,6 @@ static int pppoe_connect(struct socket *sock, struct sockaddr_unsized *uservaddr
 	goto end;
 }
 
-static int pppoe_getname(struct socket *sock, struct sockaddr *uaddr,
-		  int peer)
-{
-	int len = sizeof(struct sockaddr_pppox);
-	struct sockaddr_pppox sp;
-
-	sp.sa_family	= AF_PPPOX;
-	sp.sa_protocol	= PX_PROTO_OE;
-	memcpy(&sp.sa_addr.pppoe, &pppox_sk(sock->sk)->pppoe_pa,
-	       sizeof(struct pppoe_addr));
-
-	memcpy(uaddr, &sp, len);
-
-	return len;
-}
-
 static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
 		unsigned long arg)
 {
@@ -1049,7 +1033,7 @@ static const struct proto_ops pppoe_ops = {
 	.connect	= pppoe_connect,
 	.socketpair	= sock_no_socketpair,
 	.accept		= sock_no_accept,
-	.getname	= pppoe_getname,
+	.getname	= sock_no_getname,
 	.poll		= datagram_poll,
 	.listen		= sock_no_listen,
 	.shutdown	= sock_no_shutdown,
-- 
2.43.0