summaryrefslogtreecommitdiff
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-05 01:03:48 +0100
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:23 -0500
commit0c31835993e622fa9d407807e384c0f9b971d53b (patch)
tree5d5b4f15262f507534fe4ec70cad346e2cc16306 /net/nfc
parent2fbabfa467ce945deb92bf04c745b4d101fc21ee (diff)
downloadlwn-0c31835993e622fa9d407807e384c0f9b971d53b.tar.gz
lwn-0c31835993e622fa9d407807e384c0f9b971d53b.zip
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>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp/sock.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index b8bef367ee49..d3861773fab0 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -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);