mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
tun/tap: correct ref count on cloned cdevs
Reported and tested by: eugen PR: 273418 Discussed with: jah, kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42008
This commit is contained in:
parent
792655abd6
commit
27f1ec0be2
1 changed files with 4 additions and 1 deletions
|
|
@ -548,6 +548,7 @@ tun_clone_create(struct if_clone *ifc, char *name, size_t len,
|
|||
if (i != 0)
|
||||
i = tun_create_device(drv, unit, NULL, &dev, name);
|
||||
if (i == 0) {
|
||||
dev_ref(dev);
|
||||
tuncreate(dev);
|
||||
struct tuntap_softc *tp = dev->si_drv1;
|
||||
*ifpp = tp->tun_ifp;
|
||||
|
|
@ -611,8 +612,10 @@ tunclone(void *arg, struct ucred *cred, char *name, int namelen,
|
|||
|
||||
i = tun_create_device(drv, u, cred, dev, name);
|
||||
}
|
||||
if (i == 0)
|
||||
if (i == 0) {
|
||||
dev_ref(*dev);
|
||||
if_clone_create(name, namelen, NULL);
|
||||
}
|
||||
out:
|
||||
CURVNET_RESTORE();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue