aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-02-21 11:01:06 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-03-08 11:35:22 -0500
commit3bbc0ceb7ac2bf694d31362eea2c71a680e5deeb (patch)
treec03c9ab518bbab232da3b035a956254e87e44ed1 /net/nfc
parente6a3a4bb856a6fba551b43376c80f45836132710 (diff)
NFC: llcp: Report error to pending sockets when a device is removed
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/llcp/llcp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 8a35423ead54..b530afadd76c 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -68,7 +68,8 @@ static void nfc_llcp_socket_purge(struct nfc_llcp_sock *sock)
68 } 68 }
69} 69}
70 70
71static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) 71static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
72 int err)
72{ 73{
73 struct sock *sk; 74 struct sock *sk;
74 struct hlist_node *tmp; 75 struct hlist_node *tmp;
@@ -100,7 +101,10 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
100 101
101 nfc_llcp_accept_unlink(accept_sk); 102 nfc_llcp_accept_unlink(accept_sk);
102 103
104 if (err)
105 accept_sk->sk_err = err;
103 accept_sk->sk_state = LLCP_CLOSED; 106 accept_sk->sk_state = LLCP_CLOSED;
107 accept_sk->sk_state_change(sk);
104 108
105 bh_unlock_sock(accept_sk); 109 bh_unlock_sock(accept_sk);
106 110
@@ -123,7 +127,10 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
123 continue; 127 continue;
124 } 128 }
125 129
130 if (err)
131 sk->sk_err = err;
126 sk->sk_state = LLCP_CLOSED; 132 sk->sk_state = LLCP_CLOSED;
133 sk->sk_state_change(sk);
127 134
128 bh_unlock_sock(sk); 135 bh_unlock_sock(sk);
129 136
@@ -150,8 +157,9 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
150 157
151 nfc_llcp_socket_purge(llcp_sock); 158 nfc_llcp_socket_purge(llcp_sock);
152 159
160 if (err)
161 sk->sk_err = err;
153 sk->sk_state = LLCP_CLOSED; 162 sk->sk_state = LLCP_CLOSED;
154
155 sk->sk_state_change(sk); 163 sk->sk_state_change(sk);
156 164
157 bh_unlock_sock(sk); 165 bh_unlock_sock(sk);
@@ -173,7 +181,7 @@ struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local)
173 181
174static void local_cleanup(struct nfc_llcp_local *local, bool listen) 182static void local_cleanup(struct nfc_llcp_local *local, bool listen)
175{ 183{
176 nfc_llcp_socket_release(local, listen); 184 nfc_llcp_socket_release(local, listen, ENXIO);
177 del_timer_sync(&local->link_timer); 185 del_timer_sync(&local->link_timer);
178 skb_queue_purge(&local->tx_queue); 186 skb_queue_purge(&local->tx_queue);
179 cancel_work_sync(&local->tx_work); 187 cancel_work_sync(&local->tx_work);
@@ -1382,7 +1390,7 @@ void nfc_llcp_mac_is_down(struct nfc_dev *dev)
1382 return; 1390 return;
1383 1391
1384 /* Close and purge all existing sockets */ 1392 /* Close and purge all existing sockets */
1385 nfc_llcp_socket_release(local, true); 1393 nfc_llcp_socket_release(local, true, 0);
1386} 1394}
1387 1395
1388void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, 1396void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx,