net: filter: dont block softirqs in sk_run_filter()
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 18 Jan 2011 07:46:52 +0000 (07:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Jan 2011 05:33:05 +0000 (21:33 -0800)
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>
include/net/sock.h
net/core/filter.c
net/packet/af_packet.c

index d884d268c704955711a2ee81010ac9a7738b8cfc..ba6465bf7c7affeb30763ff09cff0680c48914f6 100644 (file)
@@ -1189,7 +1189,7 @@ extern void sk_filter_release_rcu(struct rcu_head *rcu);
 static inline void sk_filter_release(struct sk_filter *fp)
 {
        if (atomic_dec_and_test(&fp->refcnt))
-               call_rcu_bh(&fp->rcu, sk_filter_release_rcu);
+               call_rcu(&fp->rcu, sk_filter_release_rcu);
 }
 
 static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
index afc58374ca961a3b5496727d8836824a3bd83b7d..232b1873bb28988069ef1b1642ad8cd7ef689b8f 100644 (file)
@@ -142,14 +142,14 @@ int sk_filter(struct sock *sk, struct sk_buff *skb)
        if (err)
                return err;
 
-       rcu_read_lock_bh();
-       filter = rcu_dereference_bh(sk->sk_filter);
+       rcu_read_lock();
+       filter = rcu_dereference(sk->sk_filter);
        if (filter) {
                unsigned int pkt_len = sk_run_filter(skb, filter->insns);
 
                err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
        }
-       rcu_read_unlock_bh();
+       rcu_read_unlock();
 
        return err;
 }
index 91cb1d71f018d8b6b77c029dca1b99cb2855ef21..c3fc7b70a879fca41d1cf0170c10690273db8b45 100644 (file)
@@ -523,11 +523,11 @@ static inline unsigned int run_filter(const struct sk_buff *skb,
 {
        struct sk_filter *filter;
 
-       rcu_read_lock_bh();
-       filter = rcu_dereference_bh(sk->sk_filter);
+       rcu_read_lock();
+       filter = rcu_dereference(sk->sk_filter);
        if (filter != NULL)
                res = sk_run_filter(skb, filter->insns);
-       rcu_read_unlock_bh();
+       rcu_read_unlock();
 
        return res;
 }