aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-06-22 11:15:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-09 16:42:18 -0400
commitebbb16d9ebbdf08aaf2963b7993d0b4a9e41b15e (patch)
treec25c062990bc65bf1f332387464bc4e8edba9c8e /net/nfc/llcp
parent8b7e8eda58cc09974708dcc6db4c202c419d6cd9 (diff)
NFC: Forbid SSAP binding to a not well known LLCP service
With not Well Known Services there is no guarantees as to which SSAP the server will be listening on, so there is no reason to support binding to a specific source SAP. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp')
-rw-r--r--net/nfc/llcp/llcp.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 1031abd13fc2..9ab17ec50ce7 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -234,24 +234,12 @@ u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local,
234 234
235 return LLCP_WKS_NUM_SAP + ssap; 235 return LLCP_WKS_NUM_SAP + ssap;
236 236
237 } else if (sock->ssap != 0) { 237 } else if (sock->ssap != 0 && sock->ssap < LLCP_WKS_NUM_SAP) {
238 if (sock->ssap < LLCP_WKS_NUM_SAP) { 238 if (!test_bit(sock->ssap, &local->local_wks)) {
239 if (!test_bit(sock->ssap, &local->local_wks)) { 239 set_bit(sock->ssap, &local->local_wks);
240 set_bit(sock->ssap, &local->local_wks); 240 mutex_unlock(&local->sdp_lock);
241 mutex_unlock(&local->sdp_lock);
242
243 return sock->ssap;
244 }
245
246 } else if (sock->ssap < LLCP_SDP_NUM_SAP) {
247 if (!test_bit(sock->ssap - LLCP_WKS_NUM_SAP,
248 &local->local_sdp)) {
249 set_bit(sock->ssap - LLCP_WKS_NUM_SAP,
250 &local->local_sdp);
251 mutex_unlock(&local->sdp_lock);
252 241
253 return sock->ssap; 242 return sock->ssap;
254 }
255 } 243 }
256 } 244 }
257 245