diff options
Diffstat (limited to 'include/net/sock.h')
| -rw-r--r-- | include/net/sock.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 6ba2e7b0e2b1..808cbc2ec6c1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -409,6 +409,11 @@ struct sock { | |||
| 409 | void (*sk_destruct)(struct sock *sk); | 409 | void (*sk_destruct)(struct sock *sk); |
| 410 | }; | 410 | }; |
| 411 | 411 | ||
| 412 | #define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data))) | ||
| 413 | |||
| 414 | #define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk))) | ||
| 415 | #define rcu_assign_sk_user_data(sk, ptr) rcu_assign_pointer(__sk_user_data((sk)), ptr) | ||
| 416 | |||
| 412 | /* | 417 | /* |
| 413 | * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK | 418 | * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK |
| 414 | * or not whether his port will be reused by someone else. SK_FORCE_REUSE | 419 | * or not whether his port will be reused by someone else. SK_FORCE_REUSE |
| @@ -1625,16 +1630,14 @@ static inline void sk_filter_release(struct sk_filter *fp) | |||
| 1625 | 1630 | ||
| 1626 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) | 1631 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) |
| 1627 | { | 1632 | { |
| 1628 | unsigned int size = sk_filter_len(fp); | 1633 | atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc); |
| 1629 | |||
| 1630 | atomic_sub(size, &sk->sk_omem_alloc); | ||
| 1631 | sk_filter_release(fp); | 1634 | sk_filter_release(fp); |
| 1632 | } | 1635 | } |
| 1633 | 1636 | ||
| 1634 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) | 1637 | static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) |
| 1635 | { | 1638 | { |
| 1636 | atomic_inc(&fp->refcnt); | 1639 | atomic_inc(&fp->refcnt); |
| 1637 | atomic_add(sk_filter_len(fp), &sk->sk_omem_alloc); | 1640 | atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc); |
| 1638 | } | 1641 | } |
| 1639 | 1642 | ||
| 1640 | /* | 1643 | /* |
