Re: [PATCH net V3 2/2] tuntap: synchronize through tfiles array instead of tun->numqueues

From: David Miller
Date: Thu May 09 2019 - 12:23:56 EST


From: Jason Wang <jasowang@xxxxxxxxxx>
Date: Wed, 8 May 2019 23:20:18 -0400

> When a queue(tfile) is detached through __tun_detach(), we move the
> last enabled tfile to the position where detached one sit but don't
> NULL out last position. We expect to synchronize the datapath through
> tun->numqueues. Unfortunately, this won't work since we're lacking
> sufficient mechanism to order or synchronize the access to
> tun->numqueues.
>
> To fix this, NULL out the last position during detaching and check
> RCU protected tfile against NULL instead of checking tun->numqueues in
> datapath.
>
> Cc: YueHaibing <yuehaibing@xxxxxxxxxx>
> Cc: Cong Wang <xiyou.wangcong@xxxxxxxxx>
> Cc: weiyongjun (A) <weiyongjun1@xxxxxxxxxx>
> Cc: Eric Dumazet <eric.dumazet@xxxxxxxxx>
> Fixes: c8d68e6be1c3b ("tuntap: multiqueue support")
> Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
> ---
> Changes from V2:
> - resample during detach in tun_xdp_xmit()
> Changes from V1:
> - keep the check in tun_xdp_xmit()

Applied and queued up for -stable.