Skip to content

Commit

Permalink
netrom: Fix sock_orphan() use in nr_release
Browse files Browse the repository at this point in the history
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 <f6bvp@free.fr>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Oct 6, 2008
1 parent 33d1d2c commit 859f4c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netrom/af_netrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;

Expand Down

0 comments on commit 859f4c7

Please sign in to comment.