public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* x25_create initializing socket data twice ...
@ 2005-03-03  1:14 Herbert Poetzl
  2005-03-03  3:20 ` Andrew Hendry
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Poetzl @ 2005-03-03  1:14 UTC (permalink / raw)
  To: eis, linux-x25; +Cc: Linux Kernel ML


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.orig	2005-03-02 12:39:11 +0100
+++ ./net/x25/af_x25.c	2005-03-03 02:12:11 +0100
@@ -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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: x25_create initializing socket data twice ...
  2005-03-03  1:14 x25_create initializing socket data twice Herbert Poetzl
@ 2005-03-03  3:20 ` Andrew Hendry
  2005-03-03 19:37   ` Aristeu Sergio Rozanski Filho
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Hendry @ 2005-03-03  3:20 UTC (permalink / raw)
  To: Herbert Poetzl; +Cc: eis, linux-x25, Linux Kernel ML

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.

On Thu, 2005-03-03 at 12:14, Herbert Poetzl wrote:
> 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.orig	2005-03-02 12:39:11 +0100
> +++ ./net/x25/af_x25.c	2005-03-03 02:12:11 +0100
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: x25_create initializing socket data twice ...
  2005-03-03  3:20 ` Andrew Hendry
@ 2005-03-03 19:37   ` Aristeu Sergio Rozanski Filho
  0 siblings, 0 replies; 3+ messages in thread
From: Aristeu Sergio Rozanski Filho @ 2005-03-03 19:37 UTC (permalink / raw)
  To: Andrew Hendry; +Cc: Herbert Poetzl, eis, linux-x25, Linux Kernel ML

Hi,
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-03 19:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-03  1:14 x25_create initializing socket data twice Herbert Poetzl
2005-03-03  3:20 ` Andrew Hendry
2005-03-03 19:37   ` Aristeu Sergio Rozanski Filho

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