Skip to contentSkip to conversation

l2tp: Don't assign net->gen->ptr[] for pppol2tp_net_ops.

PATCH In review Kuniyuki Iwashima 2 participants 3 messages Jul 22, 2024 – Jul 23, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 l2tp: Don't assign net->gen->ptr[] for pppol2tp_net_ops.

Commit fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") converted net->gen->ptr[pppol2tp_net_id] in l2tp_ppp.c to net->gen->ptr[l2tp_net_id] in l2tp_core.c.

Now the leftover wastes one entry of net->gen->ptr[] in each netns.

Let's avoid the unwanted allocation.

Fixes fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
---
 net/l2tp/l2tp_ppp.c | 3 ---
 1 file changed, 3 deletions(-)
net/l2tp/l2tp_ppp.c +0 -3
index 3596290047b2..246089b17910 100644
@@ -1406,8 +1406,6 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname,
  * L2TPv2, we dump only L2TPv2 tunnels and sessions here.
  *****************************************************************************/
 
-static unsigned int pppol2tp_net_id;
-
 #ifdef CONFIG_PROC_FS
 
 struct pppol2tp_seq_data {
@@ -1641,7 +1639,6 @@ static __net_exit void pppol2tp_exit_net(struct net *net)
 static struct pernet_operations pppol2tp_net_ops = {
 	.init = pppol2tp_init_net,
 	.exit = pppol2tp_exit_net,
-	.id   = &pppol2tp_net_id,
 };
 
 /*****************************************************************************
Signature · 1 line
2.30.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Kuniyuki Iwashima

Commit fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") converted net->gen->ptr[pppol2tp_net_id] in l2tp_ppp.c to net->gen->ptr[l2tp_net_id] in l2tp_core.c.

Now the leftover wastes one entry of net->gen->ptr[] in each netns.

Let's avoid the unwanted allocation.

Fixes fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")

Hi Iwashima-san,

It looks like this problem is a resource overuse that has been present since 2010. So I lean towards it being a clean-up for net-next rather than a fix.

That notwithstanding, this looks good to me.

...

#2 lore raw

From: Simon Horman <[email protected]>
Date: Tue, 23 Jul 2024 09:50:23 +0100

Quoted 14 lines · Kuniyuki Iwashima
Quoted 10 lines

Commit fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") converted net->gen->ptr[pppol2tp_net_id] in l2tp_ppp.c to net->gen->ptr[l2tp_net_id] in l2tp_core.c.

Now the leftover wastes one entry of net->gen->ptr[] in each netns.

Let's avoid the unwanted allocation.

Fixes fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")

Hi Iwashima-san,

Quoted 7 lines

It looks like this problem is a resource overuse that has been present since 2010. So I lean towards it being a clean-up for net-next rather than a fix.

That notwithstanding, this looks good to me.

Thanks, Simon.

Will post this next week in a seris.