From: Samuel Ortiz <sameo@linux.intel.com>
Date: Fri, 22 Jun 2012 13:32:20 +0000 (+0200)
Subject: NFC: Forbid LLCP service name reusing
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8b7e8eda58cc09974708dcc6db4c202c419d6cd9;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git

NFC: Forbid LLCP service name reusing

This patch fixes a typo and return the correct error when trying to
bind 2 sockets to the same service name.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---

diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 211cb234f7a3..e5d80142b825 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -121,8 +121,10 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
 					  GFP_KERNEL);
 
 	llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
-	if (llcp_sock->ssap == LLCP_MAX_SAP)
+	if (llcp_sock->ssap == LLCP_SAP_MAX) {
+		ret = -EADDRINUSE;
 		goto put_dev;
+	}
 
 	llcp_sock->reserved_ssap = llcp_sock->ssap;