[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190508.103613.1782548019381525988.davem@davemloft.net>
Date: Wed, 08 May 2019 10:36:13 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: jasowang@...hat.com
Cc: netdev@...r.kernel.org, mst@...hat.com, yuehaibing@...wei.com,
xiyou.wangcong@...il.com, weiyongjun1@...wei.com,
eric.dumazet@...il.com
Subject: Re: [PATCH net V2] tuntap: synchronize through tfiles array
instead of tun->numqueues
From: Jason Wang <jasowang@...hat.com>
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.
Powered by blists - more mailing lists