Skip to contentSkip to conversation

: Consolidate rose socket grafting.

PATCH In review David Miller 2 participants 3 messages Jun 17, 2008 – Jun 30, 2008

Subsystems (2)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 : Consolidate rose socket grafting.

Finally, this is the rose version of the ax25 socket grafting change.

Someone sufficiently motivated might want to make a nice radio protocol stack common layer. As several have noticed and noted in the past, rose ax25 and netrom all have an enormous amount of duplicated code.

Applied and pushed to net-next-2.6

rose: Use sock_graft() and remove bogus sk_socket and sk_sleep init.

This is the rose variant of changeset 9375cb8a1232d2a15fe34bec4d3474872e02faec
("ax25: Use sock_graft() and remove bogus sk_socket and sk_sleep init.")

---
 net/rose/af_rose.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
net/rose/af_rose.c +1 -5
index 1ebf652..af86bcb 100644
@@ -566,13 +566,11 @@ static struct sock *rose_make_new(struct sock *osk)
 #endif
 
 	sk->sk_type     = osk->sk_type;
-	sk->sk_socket   = osk->sk_socket;
 	sk->sk_priority = osk->sk_priority;
 	sk->sk_protocol = osk->sk_protocol;
 	sk->sk_rcvbuf   = osk->sk_rcvbuf;
 	sk->sk_sndbuf   = osk->sk_sndbuf;
 	sk->sk_state    = TCP_ESTABLISHED;
-	sk->sk_sleep    = osk->sk_sleep;
 	sock_copy_flags(sk, osk);
 
 	init_timer(&rose->timer);
@@ -924,14 +922,12 @@ static int rose_accept(struct socket *sock, struct socket *newsock, int flags)
 		goto out_release;
 
 	newsk = skb->sk;
-	newsk->sk_socket = newsock;
-	newsk->sk_sleep = &newsock->wait;
+	sock_graft(newsk, newsock);
 
 	/* Now attach up the new socket */
 	skb->sk = NULL;
 	kfree_skb(skb);
 	sk->sk_ack_backlog--;
-	newsock->sk = newsk;
 
 out_release:
 	release_sock(sk);
Signature · 1 line
1.5.5.1.308.g1fbb5
#1 lore raw

[ROSE] unregister_netdevice: waiting for rose0 to become free

A bug in ROSE protocol is preventing removal of rose module.

After killing all ROSE and AX25 applications, there are no more sockets and rose usage count is correctly decreased to null as seen in /proc/modules :

rose 40120 0 - Live 0xe1071000

However, issuing command rmmod rose displays the following message in loop forever :

kernel: unregister_netdevice: waiting for rose0 to become free. Usage count = 2

Usage count can be different and seems random (not correlated with module usage count reached when ROSE applications are loaded).

Tracing the problem shows that above message is sent by core/dev.c

Here is the loop :

while (atomic_read(&dev->refcnt) !=0) {
....
}

Obviously, displayed usage count (dev->refcnt) is not the same as in /proc/modules or given by command lsmod and also it is not decremented, i.e. it stays at the same, and probably not relevant, value.

A comment in core/dev.c says that buggy protocol don't correctly call dev_put().

I tried to review rose module source but I have not been able to find a correct place where dev_put(dev) could be missing either in af_rose.c or rose_route.c.

Maybe the problem is elsewhere ?

Bernard Pidoux, f6bvp

#2 lore raw

Re: [ROSE] unregister_netdevice: waiting for rose0 to become free

Some more precisions :

The same message in endless loop appears even if there are no more routes using rose0 device as confirmed by route command
and after device rose0 is set down with ifconfig.

The only remaining things related to rose are in /proc/net/rose_nodes and /proc/net/rose_neigh :

#cat /proc/net/rose_node

address       mask    n    neigh   neigh   neigh
2080175524    0010    1    00001

#cat /proc/net/rose_neigh

addr    callsign   dev   count   use   mode   restart   t0   tf  digipeater
00001   RSLOOP-0   ???     1      0    DCE     yes       0    0

I can reboot the system if I do it before trying to remove rose module. Not after, because of the waiting loop.

RSLOOP-0 rose_neigh is created as soon as rose module is loaded via modprobe. If I issue rmmod rose command immediately after loading it, removal is successfull.

Thus it appears that rose_node with neigh 00001 is not destroyed during one previous step. Which one ?

Bernard Pidoux, f6bvp

Quoted 37 lines · Pidoux

A bug in ROSE protocol is preventing removal of rose module.

After killing all ROSE and AX25 applications, there are no more sockets and rose usage count is correctly decreased to null as seen in /proc/modules :

rose 40120 0 - Live 0xe1071000

However, issuing command rmmod rose displays the following message in loop forever :

kernel: unregister_netdevice: waiting for rose0 to become free. Usage count = 2

Usage count can be different and seems random (not correlated with module usage count reached when ROSE applications are loaded).

Tracing the problem shows that above message is sent by core/dev.c

Here is the loop :

while (atomic_read(&dev->refcnt) !=0) {
....
}

Obviously, displayed usage count (dev->refcnt) is not the same as in /proc/modules or given by command lsmod and also it is not decremented, i.e. it stays at the same, and probably not relevant, value.

A comment in core/dev.c says that buggy protocol don't correctly call dev_put().

I tried to review rose module source but I have not been able to find a correct place where dev_put(dev) could be missing either in af_rose.c or rose_route.c.

Maybe the problem is elsewhere ?

Bernard Pidoux, f6bvp

Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
73 de Bernard, f6bvp
http://f6bvp.org