summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangli Gao <xiaosuo@gmail.com>2010-08-07 20:35:43 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-26 16:46:00 -0700
commit1378008ccdfdfcedbd6503f00e52124bfce1e0f7 (patch)
tree8d70eb9670410eafe8ffabf9c906468a6d1b429f
parent34793c34a78af4043f119c7fc332526d5b012fd0 (diff)
net: disable preemption before call smp_processor_id()
[ Upstream commit cece1945bffcf1a823cdfa36669beae118419351 ] Although netif_rx() isn't expected to be called in process context with preemption enabled, it'd better handle this case. And this is why get_cpu() is used in the non-RPS #ifdef branch. If tree RCU is selected, rcu_read_lock() won't disable preemption, so preempt_disable() should be called explictly. Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--net/core/dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index c4e89ef60160..95cc48618043 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2504,6 +2504,7 @@ int netif_rx(struct sk_buff *skb)
struct rps_dev_flow voidflow, *rflow = &voidflow;
int cpu;
+ preempt_disable();
rcu_read_lock();
cpu = get_rps_cpu(skb->dev, skb, &rflow);
@@ -2513,6 +2514,7 @@ int netif_rx(struct sk_buff *skb)
ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
rcu_read_unlock();
+ preempt_enable();
}
#else
{