diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-01-18 02:46:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-19 00:33:05 -0500 |
commit | 80f8f1027b99660897bdeaeae73002185d829906 (patch) | |
tree | b8aafe71974b2b7295f20eeb1fad6191fadd8551 | |
parent | d6ae3bae3d1bf7a8bf367e29f2cac0788dcd0db5 (diff) |
net: filter: dont block softirqs in sk_run_filter()
Packet filter (BPF) doesnt need to disable softirqs, being fully
re-entrant and lock-less.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sock.h | 2 | ||||
-rw-r--r-- | net/core/filter.c | 6 | ||||
-rw-r--r-- | net/packet/af_packet.c | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index d884d268c704..ba6465bf7c7a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1189,7 +1189,7 @@ extern void sk_filter_release_rcu(struct rcu_head *rcu); | |||
1189 | static inline void sk_filter_release(struct sk_filter *fp) | 1189 | static inline void sk_filter_release(struct sk_filter *fp) |
1190 | { | 1190 | { |
1191 | if (atomic_dec_and_test(&fp->refcnt)) | 1191 | if (atomic_dec_and_test(&fp->refcnt)) |
1192 | call_rcu_bh(&fp->rcu, sk_filter_release_rcu); | 1192 | call_rcu(&fp->rcu, sk_filter_release_rcu); |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) | 1195 | static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) |
diff --git a/net/core/filter.c b/net/core/filter.c index afc58374ca96..232b1873bb28 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -142,14 +142,14 @@ int sk_filter(struct sock *sk, struct sk_buff *skb) | |||
142 | if (err) | 142 | if (err) |
143 | return err; | 143 | return err; |
144 | 144 | ||
145 | rcu_read_lock_bh(); | 145 | rcu_read_lock(); |
146 | filter = rcu_dereference_bh(sk->sk_filter); | 146 | filter = rcu_dereference(sk->sk_filter); |
147 | if (filter) { | 147 | if (filter) { |
148 | unsigned int pkt_len = sk_run_filter(skb, filter->insns); | 148 | unsigned int pkt_len = sk_run_filter(skb, filter->insns); |
149 | 149 | ||
150 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; | 150 | err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; |
151 | } | 151 | } |
152 | rcu_read_unlock_bh(); | 152 | rcu_read_unlock(); |
153 | 153 | ||
154 | return err; | 154 | return err; |
155 | } | 155 | } |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 91cb1d71f018..c3fc7b70a879 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -523,11 +523,11 @@ static inline unsigned int run_filter(const struct sk_buff *skb, | |||
523 | { | 523 | { |
524 | struct sk_filter *filter; | 524 | struct sk_filter *filter; |
525 | 525 | ||
526 | rcu_read_lock_bh(); | 526 | rcu_read_lock(); |
527 | filter = rcu_dereference_bh(sk->sk_filter); | 527 | filter = rcu_dereference(sk->sk_filter); |
528 | if (filter != NULL) | 528 | if (filter != NULL) |
529 | res = sk_run_filter(skb, filter->insns); | 529 | res = sk_run_filter(skb, filter->insns); |
530 | rcu_read_unlock_bh(); | 530 | rcu_read_unlock(); |
531 | 531 | ||
532 | return res; | 532 | return res; |
533 | } | 533 | } |