aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/llcp/sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/llcp/sock.c')
-rw-r--r--net/nfc/llcp/sock.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 5332751943a9..6c94447ec414 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -270,7 +270,9 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
270 } 270 }
271 271
272 if (sk->sk_state == LLCP_CONNECTED || !newsock) { 272 if (sk->sk_state == LLCP_CONNECTED || !newsock) {
273 nfc_llcp_accept_unlink(sk); 273 list_del_init(&lsk->accept_queue);
274 sock_put(sk);
275
274 if (newsock) 276 if (newsock)
275 sock_graft(sk, newsock); 277 sock_graft(sk, newsock);
276 278
@@ -278,6 +280,8 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
278 280
279 pr_debug("Returning sk state %d\n", sk->sk_state); 281 pr_debug("Returning sk state %d\n", sk->sk_state);
280 282
283 sk_acceptq_removed(parent);
284
281 return sk; 285 return sk;
282 } 286 }
283 287
@@ -462,8 +466,6 @@ static int llcp_sock_release(struct socket *sock)
462 nfc_llcp_accept_unlink(accept_sk); 466 nfc_llcp_accept_unlink(accept_sk);
463 467
464 release_sock(accept_sk); 468 release_sock(accept_sk);
465
466 sock_orphan(accept_sk);
467 } 469 }
468 } 470 }
469 471
@@ -644,6 +646,8 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
644 646
645 pr_debug("%p %zu\n", sk, len); 647 pr_debug("%p %zu\n", sk, len);
646 648
649 msg->msg_namelen = 0;
650
647 lock_sock(sk); 651 lock_sock(sk);
648 652
649 if (sk->sk_state == LLCP_CLOSED && 653 if (sk->sk_state == LLCP_CLOSED &&
@@ -689,6 +693,7 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
689 693
690 pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap); 694 pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap);
691 695
696 memset(sockaddr, 0, sizeof(*sockaddr));
692 sockaddr->sa_family = AF_NFC; 697 sockaddr->sa_family = AF_NFC;
693 sockaddr->nfc_protocol = NFC_PROTO_NFC_DEP; 698 sockaddr->nfc_protocol = NFC_PROTO_NFC_DEP;
694 sockaddr->dsap = ui_cb->dsap; 699 sockaddr->dsap = ui_cb->dsap;