• Jason Wang's avatar
    tuntap: forbid calling TUNSETIFF when detached · 7c0c3b1a
    Jason Wang authored
    Michael points out that even after Stefan's fix the TUNSETIFF is still allowed
    to create a new tap device. This because we only check tfile->tun but the
    tfile->detached were introduced. Fix this by failing early in tun_set_iff() if
    the file is detached. After this fix, there's no need to do the check again in
    tun_set_iff(), so this patch removes it.
    
    Cc: Michael S. Tsirkin <mst@redhat.com>
    Cc: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7c0c3b1a
tun.c 52.8 KB