OpenBSD cvs log

created 2022-02-21T09:56:34Z
begin 2022-02-16T01:45:31Z
end 2022-02-16T02:22:39Z
path src/sys
commits 1

date 2022-02-16T02:22:39Z
author dlg
files src/sys/net/if_tun.c log diff annotate
message prevent (re)opening of tun/tap interfaces that are being destroyed.

if an open tun (or tap) device is destroyed via the clone destroy
ioctl (eg, like what ifconfig destroy does), there is a window while
the open device is being revoked on the vfs side that a third thread
can come and open it again. this in turn triggers a kassert in the
ifconfig destroy path where it expects the
device to be closed.

fix this by having tun_dev_open check for the TUN_DEAD flag that
the destroy function sets. this still relies on the kernel lock for
serialisation.

Reported-by: [email protected]
ok visa@