diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-06-21 11:41:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-09 16:42:15 -0400 |
commit | 12e5bdfefa45ecacd22c519875d06113f95a26af (patch) | |
tree | e1579a0a0146bdef0e3a9acffa92c4000bfa8721 /net/nfc/llcp/sock.c | |
parent | 025f152046c8a4101a61943ab2065fdf1fa02c0e (diff) |
NFC: Fix LLCP getname socket op
Set the right target index and use a better socket declaration routine.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r-- | net/nfc/llcp/sock.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c index 05ca5a680071..b08e99d2c715 100644 --- a/net/nfc/llcp/sock.c +++ b/net/nfc/llcp/sock.c | |||
@@ -283,22 +283,25 @@ error: | |||
283 | return ret; | 283 | return ret; |
284 | } | 284 | } |
285 | 285 | ||
286 | static int llcp_sock_getname(struct socket *sock, struct sockaddr *addr, | 286 | static int llcp_sock_getname(struct socket *sock, struct sockaddr *uaddr, |
287 | int *len, int peer) | 287 | int *len, int peer) |
288 | { | 288 | { |
289 | struct sockaddr_nfc_llcp *llcp_addr = (struct sockaddr_nfc_llcp *)addr; | ||
290 | struct sock *sk = sock->sk; | 289 | struct sock *sk = sock->sk; |
291 | struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); | 290 | struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); |
291 | DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, llcp_addr, uaddr); | ||
292 | 292 | ||
293 | pr_debug("%p\n", sk); | 293 | pr_debug("%p %d %d %d\n", sk, llcp_sock->target_idx, |
294 | llcp_sock->dsap, llcp_sock->ssap); | ||
294 | 295 | ||
295 | if (llcp_sock == NULL || llcp_sock->dev == NULL) | 296 | if (llcp_sock == NULL || llcp_sock->dev == NULL) |
296 | return -EBADFD; | 297 | return -EBADFD; |
297 | 298 | ||
298 | addr->sa_family = AF_NFC; | 299 | uaddr->sa_family = AF_NFC; |
300 | |||
299 | *len = sizeof(struct sockaddr_nfc_llcp); | 301 | *len = sizeof(struct sockaddr_nfc_llcp); |
300 | 302 | ||
301 | llcp_addr->dev_idx = llcp_sock->dev->idx; | 303 | llcp_addr->dev_idx = llcp_sock->dev->idx; |
304 | llcp_addr->target_idx = llcp_sock->target_idx; | ||
302 | llcp_addr->dsap = llcp_sock->dsap; | 305 | llcp_addr->dsap = llcp_sock->dsap; |
303 | llcp_addr->ssap = llcp_sock->ssap; | 306 | llcp_addr->ssap = llcp_sock->ssap; |
304 | llcp_addr->service_name_len = llcp_sock->service_name_len; | 307 | llcp_addr->service_name_len = llcp_sock->service_name_len; |