git: 6e92fc930943 - main - vkbd: correct ref count on cloned cdevs

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 09 Oct 2023 23:38:13 UTC
The branch main has been updated by kib:

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

commit 6e92fc930943a85f311e986a02e2b3dae9e37126
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-10-02 22:25:52 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-10-09 23:37:43 +0000

    vkbd: correct ref count on cloned cdevs
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D42008
---
 sys/dev/vkbd/vkbd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c
index a8d4583f46c7..3dbf64063e33 100644
--- a/sys/dev/vkbd/vkbd.c
+++ b/sys/dev/vkbd/vkbd.c
@@ -191,6 +191,8 @@ vkbd_dev_clone(void *arg, struct ucred *cred, char *name, int namelen,
 		*dev = make_dev_credf(MAKEDEV_REF, &vkbd_dev_cdevsw, unit,
 			cred, UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME "%d",
 			unit);
+	else
+		dev_ref(*dev);
 }
 
 /* Open device */