Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 53463
b: refs/heads/master
c: 3f660d6
h: refs/heads/master
i:
  53461: 2cc5487
  53459: 4948c67
  53455: 1abd1da
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed May 3, 2007
1 parent 73f644a commit 4fef0bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be52178b9f73969b583c6a781ca613f4e601221a
refs/heads/master: 3f660d66dfbc13ea4b61d3865851b348444c24b4
29 changes: 15 additions & 14 deletions trunk/net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ static struct hlist_head *nl_pid_hashfn(struct nl_pid_hash *hash, u32 pid)

static void netlink_sock_destruct(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);

BUG_ON(mutex_is_locked(nlk_sk(sk)->cb_mutex));
if (nlk->cb) {
if (nlk->cb->done)
nlk->cb->done(nlk->cb);
netlink_destroy_callback(nlk->cb);
}

skb_queue_purge(&sk->sk_receive_queue);

if (!sock_flag(sk, SOCK_DEAD)) {
Expand All @@ -148,7 +157,6 @@ static void netlink_sock_destruct(struct sock *sk)
}
BUG_TRAP(!atomic_read(&sk->sk_rmem_alloc));
BUG_TRAP(!atomic_read(&sk->sk_wmem_alloc));
BUG_TRAP(!nlk_sk(sk)->cb);
BUG_TRAP(!nlk_sk(sk)->groups);
}

Expand Down Expand Up @@ -456,17 +464,10 @@ static int netlink_release(struct socket *sock)
sock_orphan(sk);
nlk = nlk_sk(sk);

mutex_lock(nlk->cb_mutex);
if (nlk->cb) {
if (nlk->cb->done)
nlk->cb->done(nlk->cb);
netlink_destroy_callback(nlk->cb);
nlk->cb = NULL;
}
mutex_unlock(nlk->cb_mutex);

/* OK. Socket is unlinked, and, therefore,
no new packets will arrive */
/*
* OK. Socket is unlinked, any packets that arrive now
* will be purged.
*/

sock->sk = NULL;
wake_up_interruptible_all(&nlk->wait);
Expand Down Expand Up @@ -1426,9 +1427,9 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
return -ECONNREFUSED;
}
nlk = nlk_sk(sk);
/* A dump or destruction is in progress... */
/* A dump is in progress... */
mutex_lock(nlk->cb_mutex);
if (nlk->cb || sock_flag(sk, SOCK_DEAD)) {
if (nlk->cb) {
mutex_unlock(nlk->cb_mutex);
netlink_destroy_callback(cb);
sock_put(sk);
Expand Down

0 comments on commit 4fef0bc

Please sign in to comment.