diff mbox

[23/33] NFC: Forbid LLCP service name reusing

Message ID 1341605393-32056-24-git-send-email-sameo@linux.intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Samuel Ortiz July 6, 2012, 8:09 p.m. UTC
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>
---
 net/nfc/llcp/sock.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 211cb23..e5d8014 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;