Subject: Re: [AX25] kernel panic

From: Bernard Pidoux <[email-masked]>
Date: Sun, 30 Mar 2008 19:38:51 +0200

Jarek Poplawski wrote:

> On Sun, Mar 30, 2008 at 10:43:07AM +0200, Bernard Pidoux wrote:
>> Hi Jarek,
> 
> Hi Bernard,
>> please find attached another collection of data from  
>> /var/log/kernel/info.log that I bziped for it is rather large.
> 
> Thanks again. It looks like ROSE sockets aren't released properly.
> Here is a try to fix this. Could you test it with all previous patches
> present?
> 
> Regards,
> Jarek P.
> 
> (patch #5)
> ---
> 
> diff -Nurp 2.6.24.4-/net/rose/af_rose.c 2.6.24.4+/net/rose/af_rose.c
> --- 2.6.24.4-/net/rose/af_rose.c	2008-01-24 23:58:37.000000000 +0100
> +++ 2.6.24.4+/net/rose/af_rose.c	2008-03-30 10:53:19.000000000 +0200
> @@ -599,17 +599,24 @@ static int rose_release(struct socket *s
>  
>  	if (sk == NULL) return 0;
>  
> +	sock_hold(sk);
> +	sock_orphan(sk);
> +	lock_sock(sk);
>  	rose = rose_sk(sk);
>  
>  	switch (rose->state) {
>  	case ROSE_STATE_0:
> +		release_sock(sk);
>  		rose_disconnect(sk, 0, -1, -1);
> +		lock_sock(sk);
>  		rose_destroy_socket(sk);
>  		break;
>  
>  	case ROSE_STATE_2:
>  		rose->neighbour->use--;
> +		release_sock(sk);
>  		rose_disconnect(sk, 0, -1, -1);
> +		lock_sock(sk);
>  		rose_destroy_socket(sk);
>  		break;
>  
> @@ -634,6 +641,8 @@ static int rose_release(struct socket *s
>  	}
>  
>  	sock->sk = NULL;
> +	release_sock(sk);
> +	sock_put(sk);
>  
>  	return 0;
>  }
> --

Jarek,

It looks like you hit the right target !

There is no more warnings and no more ax25_frames_acked or
sk_ax25_debug.

We only get ax25_create and ax25_release data, plus ax25_make_new when 
there is an AX25 connexion.

cat /var/log/messages | grep 'Mar 30 17' | grep AX...
Mar 30 17:00:58 f6bvp-9 kernel: AX25+ ax25_create, 866, c73a6738, c3300040
Mar 30 17:00:58 f6bvp-9 kernel: AX25- ax25_release, 959, c73a6738, c3300040
Mar 30 17:00:58 f6bvp-9 kernel: AX25+ ax25_create, 866, c73a6738, c3300040
Mar 30 17:00:58 f6bvp-9 kernel: AX25- ax25_release, 959, c73a6738, c3300040
Mar 30 17:01:23 f6bvp-9 kernel: AX25; ax25_make_new, 943, c73a6738, c762a820
Mar 30 17:01:23 f6bvp-9 kernel: AX25= ax25_accept, 1386, c73a6738, 
c762a820, c3300040
Mar 30 17:01:58 f6bvp-9 kernel: AX25+ ax25_create, 866, c73a6f68, c7673ac0
Mar 30 17:01:58 f6bvp-9 kernel: AX25- ax25_release, 959, c73a6f68, c7673ac0
Mar 30 17:01:58 f6bvp-9 kernel: AX25+ ax25_create, 866, c73a6f68, c7673ac0

Please excuse the following questions if you find they are too naive.
Could you tell us how did you suspect ROSE socket from the data 
collected ? and why improperly released ROSE sockets could interfere 
with AX25 ?

Regards,

Bernard P.