summaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp/sock.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-06-22 15:32:20 +0200
committerJohn W. Linville <linville@tuxdriver.com>2012-07-09 16:42:18 -0400
commit8b7e8eda58cc09974708dcc6db4c202c419d6cd9 (patch)
treee81fee2a721f9aa3009b21a0cddfc30cb7267472 /net/nfc/llcp/sock.c
parentcbbf472181bd5d6229decda96b34b0c2bbcb3050 (diff)
downloadlinux-8b7e8eda58cc09974708dcc6db4c202c419d6cd9.tar.gz
linux-8b7e8eda58cc09974708dcc6db4c202c419d6cd9.tar.bz2
linux-8b7e8eda58cc09974708dcc6db4c202c419d6cd9.zip
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>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r--net/nfc/llcp/sock.c4
1 files changed, 3 insertions, 1 deletions
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;