diff options
Diffstat (limited to 'net/packet/af_packet.c')
| -rw-r--r-- | net/packet/af_packet.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 4cb2dfba0993..eb6be5030c70 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
| @@ -139,9 +139,6 @@ dev->hard_header == NULL (ll header is added by device, we cannot control it) | |||
| 139 | static HLIST_HEAD(packet_sklist); | 139 | static HLIST_HEAD(packet_sklist); |
| 140 | static DEFINE_RWLOCK(packet_sklist_lock); | 140 | static DEFINE_RWLOCK(packet_sklist_lock); |
| 141 | 141 | ||
| 142 | static atomic_t packet_socks_nr; | ||
| 143 | |||
| 144 | |||
| 145 | /* Private packet socket structures. */ | 142 | /* Private packet socket structures. */ |
| 146 | 143 | ||
| 147 | struct packet_mclist | 144 | struct packet_mclist |
| @@ -236,10 +233,7 @@ static void packet_sock_destruct(struct sock *sk) | |||
| 236 | return; | 233 | return; |
| 237 | } | 234 | } |
| 238 | 235 | ||
| 239 | atomic_dec(&packet_socks_nr); | 236 | sk_refcnt_debug_dec(sk); |
| 240 | #ifdef PACKET_REFCNT_DEBUG | ||
| 241 | printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr)); | ||
| 242 | #endif | ||
| 243 | } | 237 | } |
| 244 | 238 | ||
| 245 | 239 | ||
| @@ -515,7 +509,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
| 515 | sll->sll_hatype = dev->type; | 509 | sll->sll_hatype = dev->type; |
| 516 | sll->sll_protocol = skb->protocol; | 510 | sll->sll_protocol = skb->protocol; |
| 517 | sll->sll_pkttype = skb->pkt_type; | 511 | sll->sll_pkttype = skb->pkt_type; |
| 518 | if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) | 512 | if (unlikely(po->origdev)) |
| 519 | sll->sll_ifindex = orig_dev->ifindex; | 513 | sll->sll_ifindex = orig_dev->ifindex; |
| 520 | else | 514 | else |
| 521 | sll->sll_ifindex = dev->ifindex; | 515 | sll->sll_ifindex = dev->ifindex; |
| @@ -661,7 +655,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
| 661 | sll->sll_hatype = dev->type; | 655 | sll->sll_hatype = dev->type; |
| 662 | sll->sll_protocol = skb->protocol; | 656 | sll->sll_protocol = skb->protocol; |
| 663 | sll->sll_pkttype = skb->pkt_type; | 657 | sll->sll_pkttype = skb->pkt_type; |
| 664 | if (unlikely(po->origdev) && skb->pkt_type == PACKET_HOST) | 658 | if (unlikely(po->origdev)) |
| 665 | sll->sll_ifindex = orig_dev->ifindex; | 659 | sll->sll_ifindex = orig_dev->ifindex; |
| 666 | else | 660 | else |
| 667 | sll->sll_ifindex = dev->ifindex; | 661 | sll->sll_ifindex = dev->ifindex; |
| @@ -849,6 +843,7 @@ static int packet_release(struct socket *sock) | |||
| 849 | /* Purge queues */ | 843 | /* Purge queues */ |
| 850 | 844 | ||
| 851 | skb_queue_purge(&sk->sk_receive_queue); | 845 | skb_queue_purge(&sk->sk_receive_queue); |
| 846 | sk_refcnt_debug_release(sk); | ||
| 852 | 847 | ||
| 853 | sock_put(sk); | 848 | sock_put(sk); |
| 854 | return 0; | 849 | return 0; |
| @@ -1010,7 +1005,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol) | |||
| 1010 | po->num = proto; | 1005 | po->num = proto; |
| 1011 | 1006 | ||
| 1012 | sk->sk_destruct = packet_sock_destruct; | 1007 | sk->sk_destruct = packet_sock_destruct; |
| 1013 | atomic_inc(&packet_socks_nr); | 1008 | sk_refcnt_debug_inc(sk); |
| 1014 | 1009 | ||
| 1015 | /* | 1010 | /* |
| 1016 | * Attach a protocol block | 1011 | * Attach a protocol block |
