Skip to contentSkip to conversation

x25_create initializing socket data twice

PATCH In review [email protected] 2 participants 2 messages Mar 4, 2005 – Mar 5, 2005

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

PATCH 3/3 x25_create initializing socket data twice

From: Herbert Poetzl <[email protected]>

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.

---

 /dev/null                |    0 
 25-akpm/net/x25/af_x25.c |    1 -
 2 files changed, 1 deletion(-)
net/x25/af_x25.c renamed from net/x25/af_x25.c~x25_create-initializing-socket-data-twice +0 -1
diff -puN net/x25/af_x25.c~x25_create-initializing-socket-data-twice net/x25/af_x25.c
@@ -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);

diff -L net/x25/af_x25.c.orig -puN /dev/null /dev/null _

#1 lore raw
Quoted 8 lines · [email protected] wrote:

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.

As someone pointed out on LKML, this is broken since the sock_init_data in x25_alloc_socket() is called with the first argument set to NULL.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt