aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ifb.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-01 14:45:16 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-02 02:55:12 -0500
commit05e8689c9a3a208bf75b60662778d81e23eac460 (patch)
tree8253e265212cbd469d1b299c760dc7c38914dbf3 /drivers/net/ifb.c
parent3710becf8a58a5c6c4e797e3a3c968c161abdb41 (diff)
ifb: RCU locking avoids touching dev refcount
Avoids touching dev refcount in hotpath Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ifb.c')
-rw-r--r--drivers/net/ifb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 030913f8bd26..69c25668dd63 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -98,13 +98,15 @@ static void ri_tasklet(unsigned long dev)
98 stats->tx_packets++; 98 stats->tx_packets++;
99 stats->tx_bytes +=skb->len; 99 stats->tx_bytes +=skb->len;
100 100
101 skb->dev = dev_get_by_index(&init_net, skb->iif); 101 rcu_read_lock();
102 skb->dev = dev_get_by_index_rcu(&init_net, skb->iif);
102 if (!skb->dev) { 103 if (!skb->dev) {
104 rcu_read_unlock();
103 dev_kfree_skb(skb); 105 dev_kfree_skb(skb);
104 stats->tx_dropped++; 106 stats->tx_dropped++;
105 break; 107 break;
106 } 108 }
107 dev_put(skb->dev); 109 rcu_read_unlock();
108 skb->iif = _dev->ifindex; 110 skb->iif = _dev->ifindex;
109 111
110 if (from & AT_EGRESS) { 112 if (from & AT_EGRESS) {