summaryrefslogtreecommitdiff
path: root/net/nfc/llcp_sock.c
diff options
context:
space:
mode:
authorThierry Escande <thierry.escande@linux.intel.com>2013-06-04 13:34:51 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-14 15:45:05 +0400
commit17f7ae16aef1f58bc4af4c7a16b8778a91a30255 (patch)
tree02ee0a69207c231a5bd3939ccee7021cbbaddd65 /net/nfc/llcp_sock.c
parent58e3dd1558f56e95e7077a63340bb33e7aa42946 (diff)
downloadlinux-17f7ae16aef1f58bc4af4c7a16b8778a91a30255.tar.xz
NFC: Keep socket alive until the DISC PDU is actually sent
This patch keeps the socket alive and therefore does not remove it from the sockets list in the local until the DISC PDU has been actually sent. Otherwise we would reply with DM PDUs before sending the DISC one. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/llcp_sock.c')
-rw-r--r--net/nfc/llcp_sock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 03fd3162cee5..47e7acfc0236 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -626,6 +626,13 @@ static int llcp_sock_release(struct socket *sock)
release_sock(sk);
+ /* Keep this sock alive and therefore do not remove it from the sockets
+ * list until the DISC PDU has been actually sent. Otherwise we would
+ * reply with DM PDUs before sending the DISC one.
+ */
+ if (sk->sk_state == LLCP_DISCONNECTING)
+ return err;
+
if (sock->type == SOCK_RAW)
nfc_llcp_sock_unlink(&local->raw_sockets, sk);
else