diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2010-09-17 16:55:03 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-17 16:55:03 -0700 |
commit | f0f9deae9e7c421fa0c1c627beb8e174325e1ba7 (patch) | |
tree | 7883b0c64cc16f1c3f3f4360a4dbcc214e6a6a22 /include | |
parent | 4bdab43323b459900578b200a4b8cf9713ac8fab (diff) | |
download | kernel_samsung_aries-f0f9deae9e7c421fa0c1c627beb8e174325e1ba7.zip kernel_samsung_aries-f0f9deae9e7c421fa0c1c627beb8e174325e1ba7.tar.gz kernel_samsung_aries-f0f9deae9e7c421fa0c1c627beb8e174325e1ba7.tar.bz2 |
netpoll: Disable IRQ around RCU dereference in netpoll_rx
We cannot use rcu_dereference_bh safely in netpoll_rx as we may
be called with IRQs disabled. We could however simply disable
IRQs as that too causes BH to be disabled and is safe in either
case.
Thanks to John Linville for discovering this bug and providing
a patch.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netpoll.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 791d510..50d8009 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -63,20 +63,20 @@ static inline bool netpoll_rx(struct sk_buff *skb) unsigned long flags; bool ret = false; - rcu_read_lock_bh(); + local_irq_save(flags); npinfo = rcu_dereference_bh(skb->dev->npinfo); if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) goto out; - spin_lock_irqsave(&npinfo->rx_lock, flags); + spin_lock(&npinfo->rx_lock); /* check rx_flags again with the lock held */ if (npinfo->rx_flags && __netpoll_rx(skb)) ret = true; - spin_unlock_irqrestore(&npinfo->rx_lock, flags); + spin_unlock(&npinfo->rx_lock); out: - rcu_read_unlock_bh(); + local_irq_restore(flags); return ret; } |