Commit 0c31835993e622fa9d407807e384c0f9b971d53b

Authored by Samuel Ortiz
Committed by John W. Linville
1 parent 2fbabfa467

NFC: Unlink LLCP child sockets from llcp_sock_release

The parent socket (the bound one) could be freed before its children, so
we should unlink the children without trying to reach it through the parent.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 1 changed file with 3 additions and 13 deletions Side-by-side Diff

... ... @@ -327,20 +327,10 @@
327 327  
328 328 mutex_lock(&local->socket_lock);
329 329  
330   - if (llcp_sock == local->sockets[llcp_sock->ssap]) {
  330 + if (llcp_sock == local->sockets[llcp_sock->ssap])
331 331 local->sockets[llcp_sock->ssap] = NULL;
332   - } else {
333   - struct nfc_llcp_sock *parent, *s, *n;
334   -
335   - parent = local->sockets[llcp_sock->ssap];
336   -
337   - list_for_each_entry_safe(s, n, &parent->list, list)
338   - if (llcp_sock == s) {
339   - list_del(&s->list);
340   - break;
341   - }
342   -
343   - }
  332 + else
  333 + list_del(&llcp_sock->list);
344 334  
345 335 mutex_unlock(&local->socket_lock);
346 336