NFC: Forbid LLCP service name reusing
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 22 Jun 2012 13:32:20 +0000 (15:32 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Jul 2012 20:42:18 +0000 (16:42 -0400)
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

index 211cb234f7a39288738211fec9779b7ceeccfdc9..e5d80142b825298d134cd6a08ec8d23406496e3c 100644 (file)
@@ -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;