aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:40:30 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-18 17:40:30 -0400
commita57793651ff1a09ef18bade998632435ca2dc13f (patch)
treefffc839d7b001f196421f09f0a06491588835fe1 /include/net/sock.h
parent9cf52b2921fbe62566b6b2ee79f71203749c9e5e (diff)
parent52f095ee88d8851866bc7694ab991ca5abf21d5e (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (51 commits) [IPV6]: Fix again the fl6_sock_lookup() fixed locking [NETFILTER]: nf_conntrack_tcp: fix connection reopening fix [IPV6]: Fix race in ipv6_flowlabel_opt() when inserting two labels [IPV6]: Lost locking in fl6_sock_lookup [IPV6]: Lost locking when inserting a flowlabel in ipv6_fl_list [NETFILTER]: xt_sctp: fix mistake to pass a pointer where array is required [NET]: Fix OOPS due to missing check in dev_parse_header(). [TCP]: Remove lost_retrans zero seqno special cases [NET]: fix carrier-on bug? [NET]: Fix uninitialised variable in ip_frag_reasm() [IPSEC]: Rename mode to outer_mode and add inner_mode [IPSEC]: Disallow combinations of RO and AH/ESP/IPCOMP [IPSEC]: Use the top IPv4 route's peer instead of the bottom [IPSEC]: Store afinfo pointer in xfrm_mode [IPSEC]: Add missing BEET checks [IPSEC]: Move type and mode map into xfrm_state.c [IPSEC]: Fix length check in xfrm_parse_spi [IPSEC]: Move ip_summed zapping out of xfrm6_rcv_spi [IPSEC]: Get nexthdr from caller in xfrm6_rcv_spi [IPSEC]: Move tunnel parsing for IPv4 out of xfrm4_input ...
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h22
1 files changed, 8 insertions, 14 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 453c79d0915b..43fc3fa50d62 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -905,16 +905,6 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
905} 905}
906 906
907/** 907/**
908 * sk_filter_rcu_free: Free a socket filter
909 * @rcu: rcu_head that contains the sk_filter to free
910 */
911static inline void sk_filter_rcu_free(struct rcu_head *rcu)
912{
913 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
914 kfree(fp);
915}
916
917/**
918 * sk_filter_release: Release a socket filter 908 * sk_filter_release: Release a socket filter
919 * @sk: socket 909 * @sk: socket
920 * @fp: filter to remove 910 * @fp: filter to remove
@@ -922,14 +912,18 @@ static inline void sk_filter_rcu_free(struct rcu_head *rcu)
922 * Remove a filter from a socket and release its resources. 912 * Remove a filter from a socket and release its resources.
923 */ 913 */
924 914
925static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) 915static inline void sk_filter_release(struct sk_filter *fp)
916{
917 if (atomic_dec_and_test(&fp->refcnt))
918 kfree(fp);
919}
920
921static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
926{ 922{
927 unsigned int size = sk_filter_len(fp); 923 unsigned int size = sk_filter_len(fp);
928 924
929 atomic_sub(size, &sk->sk_omem_alloc); 925 atomic_sub(size, &sk->sk_omem_alloc);
930 926 sk_filter_release(fp);
931 if (atomic_dec_and_test(&fp->refcnt))
932 call_rcu_bh(&fp->rcu, sk_filter_rcu_free);
933} 927}
934 928
935static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 929static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)