Skip to content

Commit

Permalink
NFC: Unlink LLCP child sockets from llcp_sock_release
Browse files Browse the repository at this point in the history
The parent socket (the bound one) could be freed before its children, so
we should unlink the children without trying to reach it through the parent.

Signed-off-by: Samuel Ortiz <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
Samuel Ortiz authored and linvjw committed Mar 6, 2012
1 parent 2fbabfa commit 0c31835
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions net/nfc/llcp/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,20 +327,10 @@ static int llcp_sock_release(struct socket *sock)

mutex_lock(&local->socket_lock);

if (llcp_sock == local->sockets[llcp_sock->ssap]) {
if (llcp_sock == local->sockets[llcp_sock->ssap])
local->sockets[llcp_sock->ssap] = NULL;
} else {
struct nfc_llcp_sock *parent, *s, *n;

parent = local->sockets[llcp_sock->ssap];

list_for_each_entry_safe(s, n, &parent->list, list)
if (llcp_sock == s) {
list_del(&s->list);
break;
}

}
else
list_del(&llcp_sock->list);

mutex_unlock(&local->socket_lock);

Expand Down

0 comments on commit 0c31835

Please sign in to comment.