• Jason Wang's avatar
    tuntap: synchronize through tfiles array instead of tun->numqueues · 9871a9e4
    Jason Wang authored
    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
    To fix this, NULL out the last position during detaching and check
    RCU protected tfile against NULL instead of checking tun->numqueues in
    Cc: YueHaibing <yuehaibing@huawei.com>
    Cc: Cong Wang <xiyou.wangcong@gmail.com>
    Cc: weiyongjun (A) <weiyongjun1@huawei.com>
    Cc: Eric Dumazet <eric.dumazet@gmail.com>
    Fixes: c8d68e6b
     ("tuntap: multiqueue support")
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    Reviewed-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>