aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
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)