summaryrefslogtreecommitdiffstats
path: root/sys/dev/vkbd/vkbd.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-03-31 12:19:44 +0000
committerphk <phk@FreeBSD.org>2005-03-31 12:19:44 +0000
commit7af1e31761f34e698cdf576e46c042b327f5a612 (patch)
tree3f79498c2fd283a3ff468ae4f9116e9f395f4fa7 /sys/dev/vkbd/vkbd.c
parentbf21be6c028410767b09b4755acb72b254e317d8 (diff)
downloadFreeBSD-src-7af1e31761f34e698cdf576e46c042b327f5a612.zip
FreeBSD-src-7af1e31761f34e698cdf576e46c042b327f5a612.tar.gz
Explicitly hold a reference to the cdev we have just cloned. This
closes the race where the cdev was reclaimed before it ever made it back to devfs lookup.
Diffstat (limited to 'sys/dev/vkbd/vkbd.c')
-rw-r--r--sys/dev/vkbd/vkbd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c
index 57a40ed..a02dd3a 100644
--- a/sys/dev/vkbd/vkbd.c
+++ b/sys/dev/vkbd/vkbd.c
@@ -168,8 +168,10 @@ vkbd_dev_clone(void *arg, char *name, int namelen, struct cdev **dev)
if (clone_create(&vkbd_dev_clones, &vkbd_dev_cdevsw, &unit, dev, 0)) {
*dev = make_dev(&vkbd_dev_cdevsw, unit2minor(unit),
UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME "%d", unit);
- if (*dev != NULL)
+ if (*dev != NULL) {
+ dev_ref(*dev);
(*dev)->si_flags |= SI_CHEAPCLONE;
+ }
}
}
OpenPOWER on IntegriCloud