git: 9769b9e9c004 - stable/13 - vkbd: correct ref count on cloned cdevs

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 16 Oct 2023 07:17:42 UTC
The branch stable/13 has been updated by kib:

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

commit 9769b9e9c00471e366dceeb8d2fb0d0e16fbd204
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-10-02 22:25:52 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-10-16 07:17:23 +0000

    vkbd: correct ref count on cloned cdevs
    
    (cherry picked from commit 6e92fc930943a85f311e986a02e2b3dae9e37126)
---
 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 3725e852ecd1..6a3f63796f13 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 */