Linux PPP protocol development
 help / color / mirror / Atom feed
* [RFC net-next] pppoe: fix stale device name shown in procfs
@ 2026-07-06  9:34 Qingfang Deng
  0 siblings, 0 replies; only message in thread
From: Qingfang Deng @ 2026-07-06  9:34 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Qingfang Deng, Kees Cook, Felix Fietkau,
	Eric Woudstra, netdev, linux-kernel
  Cc: linux-ppp

In pppoe_seq_show(), the device name is currently read from
po->pppoe_pa.dev, which contains the name at the time the socket was
connected. If the lower network device is renamed afterwards, reading
/proc/net/pppoe will still print the old name.

Fix this by reading the name directly from the bound net_device via the
po->pppoe_dev pointer. Note that the pointer can be cleared when the
socket is being released, so a NULL check is required.

Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
 drivers/net/ppp/pppoe.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 4a018acb5262..5bf526c596b6 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -960,6 +960,7 @@ static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
 #ifdef CONFIG_PROC_FS
 static int pppoe_seq_show(struct seq_file *seq, void *v)
 {
+	struct net_device *dev;
 	struct pppox_sock *po;
 	char *dev_name;
 
@@ -969,7 +970,10 @@ static int pppoe_seq_show(struct seq_file *seq, void *v)
 	}
 
 	po = v;
-	dev_name = po->pppoe_pa.dev;
+	dev = READ_ONCE(po->pppoe_dev);
+	if (!dev)
+		goto out;
+	dev_name = dev->name;
 
 	seq_printf(seq, "%08X %pM %8s\n",
 		po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-06  9:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06  9:34 [RFC net-next] pppoe: fix stale device name shown in procfs Qingfang Deng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox