Skip to contentSkip to conversation

x25_create initializing socket data twice ...

PATCH Herbert Poetzl 3 participants 3 messages Mar 3, 2005

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

Hi Folks!

x25_create() [net/x25/af_x25.c] is calling sock_init_data() twice ... once indirectly via x25_alloc_socket() and a second time directly via sock_init_data(sock, sk);

while this might not look as critical as it seems, it can easily break stuff which assumes that sock_init_data() isn't called twice on the same socket ...

maybe something like this might be appropriate?

net/x25/af_x25.c renamed from net/x25/af_x25.c.orig +0 -1
@@ -490,7 +490,6 @@ static int x25_create(struct socket *soc
 
 	x25 = x25_sk(sk);
 
-	sock_init_data(sock, sk);
 	sk_set_owner(sk, THIS_MODULE);
 
 	x25_init_timers(sk);

best,
Herbert

#1 lore raw

Hi Herbert,

On the same path sk_set_owner also gets called twice, I think this causes double module use count when creating sockets. Module use count need some attention all over x25.

Im not sure if the fix is as straightforward, the calls are:
sock_init_data(sock,sk) vs
sock_init_data(NULL,sk)

Andrew.

Quoted 31 lines · Herbert Poetzl

Hi Folks!

x25_create() [net/x25/af_x25.c] is calling sock_init_data() twice ... once indirectly via x25_alloc_socket() and a second time directly via sock_init_data(sock, sk);

while this might not look as critical as it seems, it can easily break stuff which assumes that sock_init_data() isn't called twice on the same socket ...

maybe something like this might be appropriate?

net/x25/af_x25.c renamed from net/x25/af_x25.c.orig +0 -1
@@ -490,7 +490,6 @@ static int x25_create(struct socket *soc
 
 	x25 = x25_sk(sk);
 
-	sock_init_data(sock, sk);
 	sk_set_owner(sk, THIS_MODULE);
 
 	x25_init_timers(sk);

best,
Herbert

-
To unsubscribe from this list: send the line "unsubscribe linux-x25" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi,

Quoted 3 lines

On the same path sk_set_owner also gets called twice, I think this causes double module use count when creating sockets. Module use count need some attention all over x25.

I'm working on it already. I hope to send patches soon.

Is linux-x25 list alive? if not, perhaps we should add netdev to Cc.

--
Aristeu