aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-02-21 10:33:30 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-03-08 11:34:57 -0500
commite6a3a4bb856a6fba551b43376c80f45836132710 (patch)
treea2643a0723382e9f8c82d65a3980ad64a27d5f71
parent3536da06db0baa675f32de608c0a4c0f5ef0e9ff (diff)
NFC: llcp: Clean raw sockets from nfc_llcp_socket_release
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--net/nfc/llcp/llcp.c29
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)
133 } 133 }
134 134
135 write_unlock(&local->sockets.lock); 135 write_unlock(&local->sockets.lock);
136
137 /*
138 * If we want to keep the listening sockets alive,
139 * we don't touch the RAW ones.
140 */
141 if (listen == true)
142 return;
143
144 write_lock(&local->raw_sockets.lock);
145
146 sk_for_each_safe(sk, tmp, &local->raw_sockets.head) {
147 llcp_sock = nfc_llcp_sock(sk);
148
149 bh_lock_sock(sk);
150
151 nfc_llcp_socket_purge(llcp_sock);
152
153 sk->sk_state = LLCP_CLOSED;
154
155 sk->sk_state_change(sk);
156
157 bh_unlock_sock(sk);
158
159 sock_orphan(sk);
160
161 sk_del_node_init(sk);
162 }
163
164 write_unlock(&local->raw_sockets.lock);
136} 165}
137 166
138struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) 167struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local)