diff options
author | Tommy S. Christensen <tommy.christensen@tpack.net> | 2005-05-19 16:06:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-05-19 16:06:35 -0400 |
commit | 68acc024ea7391e03c2c695ba0b9fb31baa974bf (patch) | |
tree | 0a4108d9294bc1d6de5fe9fdddea8c105047acb9 | |
parent | db61ecc3352d72513c1b07805bd6f760e30c001b (diff) |
[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>
-rw-r--r-- | net/netlink/af_netlink.c | 11 |
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 | |||
697 | 697 | ||
698 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && | 698 | if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && |
699 | !test_bit(0, &nlk->state)) { | 699 | !test_bit(0, &nlk->state)) { |
700 | skb_orphan(skb); | ||
701 | skb_set_owner_r(skb, sk); | 700 | skb_set_owner_r(skb, sk); |
702 | skb_queue_tail(&sk->sk_receive_queue, skb); | 701 | skb_queue_tail(&sk->sk_receive_queue, skb); |
703 | sk->sk_data_ready(sk, skb->len); | 702 | sk->sk_data_ready(sk, skb->len); |
@@ -736,11 +735,15 @@ static inline int do_one_broadcast(struct sock *sk, | |||
736 | 735 | ||
737 | sock_hold(sk); | 736 | sock_hold(sk); |
738 | if (p->skb2 == NULL) { | 737 | if (p->skb2 == NULL) { |
739 | if (atomic_read(&p->skb->users) != 1) { | 738 | if (skb_shared(p->skb)) { |
740 | p->skb2 = skb_clone(p->skb, p->allocation); | 739 | p->skb2 = skb_clone(p->skb, p->allocation); |
741 | } else { | 740 | } else { |
742 | p->skb2 = p->skb; | 741 | p->skb2 = skb_get(p->skb); |
743 | atomic_inc(&p->skb->users); | 742 | /* |
743 | * skb ownership may have been set when | ||
744 | * delivered to a previous socket. | ||
745 | */ | ||
746 | skb_orphan(p->skb2); | ||
744 | } | 747 | } |
745 | } | 748 | } |
746 | if (p->skb2 == NULL) { | 749 | if (p->skb2 == NULL) { |