diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-02-21 16:33:30 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-03-08 17:34:57 +0100 |
commit | e6a3a4bb856a6fba551b43376c80f45836132710 (patch) | |
tree | a2643a0723382e9f8c82d65a3980ad64a27d5f71 /net | |
parent | 3536da06db0baa675f32de608c0a4c0f5ef0e9ff (diff) | |
download | blackbird-op-linux-e6a3a4bb856a6fba551b43376c80f45836132710.tar.gz blackbird-op-linux-e6a3a4bb856a6fba551b43376c80f45836132710.zip |
NFC: llcp: Clean raw sockets from nfc_llcp_socket_release
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/nfc/llcp/llcp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c index 77e1d97b3996..8a35423ead54 100644 --- a/net/nfc/llcp/llcp.c +++ b/net/nfc/llcp/llcp.c @@ -133,6 +133,35 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) } write_unlock(&local->sockets.lock); + + /* + * If we want to keep the listening sockets alive, + * we don't touch the RAW ones. + */ + if (listen == true) + return; + + write_lock(&local->raw_sockets.lock); + + sk_for_each_safe(sk, tmp, &local->raw_sockets.head) { + llcp_sock = nfc_llcp_sock(sk); + + bh_lock_sock(sk); + + nfc_llcp_socket_purge(llcp_sock); + + sk->sk_state = LLCP_CLOSED; + + sk->sk_state_change(sk); + + bh_unlock_sock(sk); + + sock_orphan(sk); + + sk_del_node_init(sk); + } + + write_unlock(&local->raw_sockets.lock); } struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) |