git: a317a58658d4 - stable/13 - if_tun: check device name

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 19 Dec 2023 00:29:49 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a317a58658d4a529211c66b675ec7998032ecb4e

commit a317a58658d4a529211c66b675ec7998032ecb4e
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-12-12 00:13:59 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-12-19 00:29:28 +0000

    if_tun: check device name
    
    PR:     266999
    
    (cherry picked from commit 0365e5fc905b425313a0a2d89f0d8e2566924df2)
---
 sys/net/if_tuntap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c
index 756aa04482cb..da55034638d1 100644
--- a/sys/net/if_tuntap.c
+++ b/sys/net/if_tuntap.c
@@ -810,7 +810,7 @@ tun_create_device(struct tuntap_driver *drv, int unit, struct ucred *cr,
 
 	make_dev_args_init(&args);
 	if (cr != NULL)
-		args.mda_flags = MAKEDEV_REF;
+		args.mda_flags = MAKEDEV_REF | MAKEDEV_CHECKNAME;
 	args.mda_devsw = &drv->cdevsw;
 	args.mda_cr = cr;
 	args.mda_uid = UID_UUCP;