Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05e8689c authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

ifb: RCU locking avoids touching dev refcount



Avoids touching dev refcount in hotpath

Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3710becf
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -98,13 +98,15 @@ static void ri_tasklet(unsigned long dev)
		stats->tx_packets++;
		stats->tx_packets++;
		stats->tx_bytes +=skb->len;
		stats->tx_bytes +=skb->len;


		skb->dev = dev_get_by_index(&init_net, skb->iif);
		rcu_read_lock();
		skb->dev = dev_get_by_index_rcu(&init_net, skb->iif);
		if (!skb->dev) {
		if (!skb->dev) {
			rcu_read_unlock();
			dev_kfree_skb(skb);
			dev_kfree_skb(skb);
			stats->tx_dropped++;
			stats->tx_dropped++;
			break;
			break;
		}
		}
		dev_put(skb->dev);
		rcu_read_unlock();
		skb->iif = _dev->ifindex;
		skb->iif = _dev->ifindex;


		if (from & AT_EGRESS) {
		if (from & AT_EGRESS) {