Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340964
b: refs/heads/master
c: f31652a
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Ortiz committed Oct 26, 2012
1 parent 7329164 commit 022ff3d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f152218840f2dc60900e2568878d3b87460d5ae8
refs/heads/master: f31652a58bee6ef145c066c8d0ae6d0b11dca1e8
31 changes: 31 additions & 0 deletions trunk/net/nfc/llcp/llcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,47 @@ void nfc_llcp_sock_unlink(struct llcp_sock_list *l, struct sock *sk)
write_unlock(&l->lock);
}

static void nfc_llcp_socket_purge(struct nfc_llcp_sock *sock)
{
struct nfc_llcp_local *local = sock->local;
struct sk_buff *s, *tmp;

pr_debug("%p\n", &sock->sk);

skb_queue_purge(&sock->tx_queue);
skb_queue_purge(&sock->tx_pending_queue);
skb_queue_purge(&sock->tx_backlog_queue);

if (local == NULL)
return;

/* Search for local pending SKBs that are related to this socket */
skb_queue_walk_safe(&local->tx_queue, s, tmp) {
if (s->sk != &sock->sk)
continue;

skb_unlink(s, &local->tx_queue);
kfree_skb(s);
}
}

static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
{
struct sock *sk;
struct hlist_node *node, *tmp;
struct nfc_llcp_sock *llcp_sock;

skb_queue_purge(&local->tx_queue);

write_lock(&local->sockets.lock);

sk_for_each_safe(sk, node, tmp, &local->sockets.head) {
llcp_sock = nfc_llcp_sock(sk);

bh_lock_sock(sk);

nfc_llcp_socket_purge(llcp_sock);

if (sk->sk_state == LLCP_CONNECTED)
nfc_put_device(llcp_sock->dev);

Expand Down Expand Up @@ -1002,6 +1030,9 @@ static void nfc_llcp_recv_disc(struct nfc_llcp_local *local,

sk = &llcp_sock->sk;
lock_sock(sk);

nfc_llcp_socket_purge(llcp_sock);

if (sk->sk_state == LLCP_CLOSED) {
release_sock(sk);
nfc_llcp_sock_put(llcp_sock);
Expand Down

0 comments on commit 022ff3d

Please sign in to comment.