diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-05-03 14:43:27 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-05-03 14:43:27 -0700 |
commit | 96c36023434b7b6824b1da72a6b7b1ca61d7310c (patch) | |
tree | 21b46ccc9e88f5ab77e0578356ba7d86e0f5c964 | |
parent | 9dfa277f88388a94993b121db46b80df66f48d9e (diff) | |
download | op-kernel-dev-96c36023434b7b6824b1da72a6b7b1ca61d7310c.zip op-kernel-dev-96c36023434b7b6824b1da72a6b7b1ca61d7310c.tar.gz |
[NETLINK]: cb_lock does not needs ref count on sk
Here is a little optimisation for the cb_lock used by netlink_dump.
While fixing that race earlier, I noticed that the reference count
held by cb_lock is completely useless. The reason is that in order
to obtain the protection of the reference count, you have to take
the cb_lock. But the only way to take the cb_lock is through
dereferencing the socket.
That is, you must already possess a reference count on the socket
before you can take advantage of the reference count held by cb_lock.
As a corollary, we can remve the reference count held by the cb_lock.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/netlink/af_netlink.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 29a5fd2..4ee39206 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -373,7 +373,6 @@ static int netlink_release(struct socket *sock) nlk->cb->done(nlk->cb); netlink_destroy_callback(nlk->cb); nlk->cb = NULL; - __sock_put(sk); } spin_unlock(&nlk->cb_lock); @@ -1099,7 +1098,6 @@ static int netlink_dump(struct sock *sk) spin_unlock(&nlk->cb_lock); netlink_destroy_callback(cb); - __sock_put(sk); return 0; } @@ -1138,7 +1136,6 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, return -EBUSY; } nlk->cb = cb; - sock_hold(sk); spin_unlock(&nlk->cb_lock); netlink_dump(sk); |