From: Samuel Ortiz Date: Mon, 5 Mar 2012 00:03:48 +0000 (+0100) Subject: NFC: Unlink LLCP child sockets from llcp_sock_release X-Git-Tag: v3.4-rc1~177^2~108^2~89 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c31835993e622fa9d407807e384c0f9b971d53b;p=profile%2Fcommon%2Fkernel-common.git 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 Signed-off-by: John W. Linville --- diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index b8bef36..d386177 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);