diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-10-25 03:47:05 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-25 14:18:28 -0700 |
commit | 0d7da9ddd9a4eb7808698d04b98bf9d62d02649b (patch) | |
tree | b170122c08d47be35a056782be54573ba19fe0b0 /net/core | |
parent | 1c87733d0682547050ccccb400cdac425fa43b39 (diff) | |
download | linux-0d7da9ddd9a4eb7808698d04b98bf9d62d02649b.tar.gz linux-0d7da9ddd9a4eb7808698d04b98bf9d62d02649b.tar.bz2 linux-0d7da9ddd9a4eb7808698d04b98bf9d62d02649b.zip |
net: add __rcu annotation to sk_filter
Add __rcu annotation to :
(struct sock)->sk_filter
And use appropriate rcu primitives to reduce sparse warnings if
CONFIG_SPARSE_RCU_POINTER=y
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/filter.c | 4 | ||||
-rw-r--r-- | net/core/sock.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 7adf50352918..7beaec36b541 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -89,8 +89,8 @@ int sk_filter(struct sock *sk, struct sk_buff *skb) rcu_read_lock_bh(); filter = rcu_dereference_bh(sk->sk_filter); if (filter) { - unsigned int pkt_len = sk_run_filter(skb, filter->insns, - filter->len); + unsigned int pkt_len = sk_run_filter(skb, filter->insns, filter->len); + err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; } rcu_read_unlock_bh(); diff --git a/net/core/sock.c b/net/core/sock.c index 11db43632df8..3eed5424e659 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1225,7 +1225,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) sock_reset_flag(newsk, SOCK_DONE); skb_queue_head_init(&newsk->sk_error_queue); - filter = newsk->sk_filter; + filter = rcu_dereference_protected(newsk->sk_filter, 1); if (filter != NULL) sk_filter_charge(newsk, filter); |