From: Jarek Poplawski Date: Mon, 6 Oct 2008 19:54:57 +0000 (-0700) Subject: netrom: Fix sock_orphan() use in nr_release X-Git-Tag: v2.6.27~6^2~5 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=859f4c74d8de4dc344b3a115367d5e22a79bddaf;p=linux-2.6-omap-h63xx.git netrom: Fix sock_orphan() use in nr_release While debugging another bug it was found that NetRom socks are sometimes seen unorphaned in sk_free(). This patch moves sock_orphan() in nr_release() to the beginning (like in ax25, or rose). Reported-and-tested-by: Bernard Pidoux f6bvp Signed-off-by: Jarek Poplawski Signed-off-by: David S. Miller --- diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 532e4faa29f..9f1ea4a27b3 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -525,6 +525,7 @@ static int nr_release(struct socket *sock) if (sk == NULL) return 0; sock_hold(sk); + sock_orphan(sk); lock_sock(sk); nr = nr_sk(sk); @@ -548,7 +549,6 @@ static int nr_release(struct socket *sock) sk->sk_state = TCP_CLOSE; sk->sk_shutdown |= SEND_SHUTDOWN; sk->sk_state_change(sk); - sock_orphan(sk); sock_set_flag(sk, SOCK_DESTROY); break;