NFC: Unlink LLCP child sockets from llcp_sock_release
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 <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
2fbabfa467
commit
0c31835993
1 changed files with 3 additions and 13 deletions
|
@ -327,20 +327,10 @@ static int llcp_sock_release(struct socket *sock)
|
||||||
|
|
||||||
mutex_lock(&local->socket_lock);
|
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;
|
local->sockets[llcp_sock->ssap] = NULL;
|
||||||
} else {
|
else
|
||||||
struct nfc_llcp_sock *parent, *s, *n;
|
list_del(&llcp_sock->list);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_unlock(&local->socket_lock);
|
mutex_unlock(&local->socket_lock);
|
||||||
|
|
||||||
|
|
Reference in a new issue