summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTommy S. Christensen <tommy.christensen@tpack.net>2005-05-20 00:06:35 +0400
committerDavid S. Miller <davem@davemloft.net>2005-05-20 00:06:35 +0400
commit68acc024ea7391e03c2c695ba0b9fb31baa974bf (patch)
tree0a4108d9294bc1d6de5fe9fdddea8c105047acb9 /net
parentdb61ecc3352d72513c1b07805bd6f760e30c001b (diff)
downloadlinux-68acc024ea7391e03c2c695ba0b9fb31baa974bf.tar.xz
[NETLINK]: Move broadcast skb_orphan to the skb_get path.
Cloned packets don't need the orphan call. Signed-off-by: Tommy S. Christensen <tommy.christensen@tpack.net> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/af_netlink.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index b40c9a976969..4b91f4b84cb7 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -697,7 +697,6 @@ static __inline__ int netlink_broadcast_deliver(struct sock *sk, struct sk_buff
if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
!test_bit(0, &nlk->state)) {
- skb_orphan(skb);
skb_set_owner_r(skb, sk);
skb_queue_tail(&sk->sk_receive_queue, skb);
sk->sk_data_ready(sk, skb->len);
@@ -736,11 +735,15 @@ static inline int do_one_broadcast(struct sock *sk,
sock_hold(sk);
if (p->skb2 == NULL) {
- if (atomic_read(&p->skb->users) != 1) {
+ if (skb_shared(p->skb)) {
p->skb2 = skb_clone(p->skb, p->allocation);
} else {
- p->skb2 = p->skb;
- atomic_inc(&p->skb->users);
+ p->skb2 = skb_get(p->skb);
+ /*
+ * skb ownership may have been set when
+ * delivered to a previous socket.
+ */
+ skb_orphan(p->skb2);
}
}
if (p->skb2 == NULL) {