NFC: Don't hold a NULL connecting LLCP socket lock
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 5705e6d..b694313 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -477,8 +477,10 @@
sk_for_each(sk, node, &local->connecting_sockets.head) {
llcp_sock = nfc_llcp_sock(sk);
- if (llcp_sock->ssap == ssap)
+ if (llcp_sock->ssap == ssap) {
+ sock_hold(&llcp_sock->sk);
goto out;
+ }
}
llcp_sock = NULL;
@@ -486,8 +488,6 @@
out:
read_unlock(&local->connecting_sockets.lock);
- sock_hold(&llcp_sock->sk);
-
return llcp_sock;
}