From: Jason Wang <[email protected]>
Date: Tue, 7 May 2019 00:03:36 -0400
> @@ -1313,6 +1315,10 @@ static int tun_xdp_xmit(struct net_device *dev, int n,
>
> tfile = rcu_dereference(tun->tfiles[smp_processor_id() %
> numqueues]);
> + if (!tfile) {
> + rcu_read_unlock();
> + return -ENXIO; /* Caller will free/return all frames */
> + }
>
> spin_lock(&tfile->tx_ring.producer_lock);
> for (i = 0; i < n; i++) {
The only way we can see a NULL here is if a detach happened in parallel,
and if that happens we should retry the tfile[] indexing after resampling
numqueues rather than dropping the packet.