Skip to content

Commit

Permalink
Phonet: listening socket lock protects the connected socket list
Browse files Browse the repository at this point in the history
The accept()'d socket need to be unhashed while the (listen()'ing)
socket lock is held. This fixes a race condition that could lead to an
OOPS.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed May 29, 2010
1 parent 97dc875 commit 7dfde17
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/phonet/pep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,12 +1045,12 @@ static void pep_sock_unhash(struct sock *sk)
lock_sock(sk);
if ((1 << sk->sk_state) & ~(TCPF_CLOSE|TCPF_LISTEN)) {
skparent = pn->listener;
sk_del_node_init(sk);
release_sock(sk);

sk = skparent;
pn = pep_sk(skparent);
lock_sock(sk);
lock_sock(skparent);
sk_del_node_init(sk);
sk = skparent;
}
/* Unhash a listening sock only when it is closed
* and all of its active connected pipes are closed. */
Expand Down

0 comments on commit 7dfde17

Please sign in to comment.