git: 23a55498a818 - stable/14 - vkbd: correct ref count on cloned cdevs

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

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

commit 23a55498a8184add2396479a09c7ba0921d057a4
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:16:01 +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 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 */