svn commit: r255359 - in head/sys: cddl/dev/dtrace dev/firewire dev/vkbd security/audit
Davide Italiano
davide at FreeBSD.org
Sat Sep 7 13:45:46 UTC 2013
Author: davide
Date: Sat Sep 7 13:45:44 2013
New Revision: 255359
URL: http://svnweb.freebsd.org/changeset/base/255359
Log:
- Use make_dev_credf(MAKEDEV_REF) instead of the race-prone make_dev()+
dev_ref() in the clone handlers that still use it.
- Don't set SI_CHEAPCLONE flag, it's not used anywhere neither in devfs
(for anything real)
Reviewed by: kib
Modified:
head/sys/cddl/dev/dtrace/dtrace_clone.c
head/sys/dev/firewire/fwdev.c
head/sys/dev/vkbd/vkbd.c
head/sys/security/audit/audit_pipe.c
Modified: head/sys/cddl/dev/dtrace/dtrace_clone.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_clone.c Sat Sep 7 11:41:52 2013 (r255358)
+++ head/sys/cddl/dev/dtrace/dtrace_clone.c Sat Sep 7 13:45:44 2013 (r255359)
@@ -52,10 +52,6 @@ dtrace_clone(void *arg, struct ucred *cr
/* Clone the device to the new minor number. */
if (clone_create(&dtrace_clones, &dtrace_cdevsw, &u, dev, 0) != 0)
/* Create the /dev/dtrace/dtraceNN entry. */
- *dev = make_dev_cred(&dtrace_cdevsw, u, cred,
+ *dev = make_dev_credf(MAKEDEV_REF, &dtrace_cdevsw, u, cred,
UID_ROOT, GID_WHEEL, 0600, "dtrace/dtrace%d", u);
- if (*dev != NULL) {
- dev_ref(*dev);
- (*dev)->si_flags |= SI_CHEAPCLONE;
- }
}
Modified: head/sys/dev/firewire/fwdev.c
==============================================================================
--- head/sys/dev/firewire/fwdev.c Sat Sep 7 11:41:52 2013 (r255358)
+++ head/sys/dev/firewire/fwdev.c Sat Sep 7 13:45:44 2013 (r255359)
@@ -992,11 +992,9 @@ found:
sc = devclass_get_softc(firewire_devclass, unit);
if (sc == NULL)
return;
- *dev = make_dev(&firewire_cdevsw, MAKEMINOR(devflag[i], unit, sub),
- UID_ROOT, GID_OPERATOR, 0660,
- "%s%d.%d", devnames[i], unit, sub);
- dev_ref(*dev);
- (*dev)->si_flags |= SI_CHEAPCLONE;
+ *dev = make_dev_credf(MAKEDEV_REF, &firewire_cdevsw,
+ MAKEMINOR(devflag[i], unit, sub), cred, UID_ROOT, GID_OPERATOR,
+ 0660, "%s%d.%d", devnames[i], unit, sub);
dev_depends(sc->dev, *dev);
return;
}
Modified: head/sys/dev/vkbd/vkbd.c
==============================================================================
--- head/sys/dev/vkbd/vkbd.c Sat Sep 7 11:41:52 2013 (r255358)
+++ head/sys/dev/vkbd/vkbd.c Sat Sep 7 13:45:44 2013 (r255359)
@@ -186,14 +186,10 @@ vkbd_dev_clone(void *arg, struct ucred *
return; /* don't recognize the name */
/* find any existing device, or allocate new unit number */
- if (clone_create(&vkbd_dev_clones, &vkbd_dev_cdevsw, &unit, dev, 0)) {
- *dev = make_dev(&vkbd_dev_cdevsw, unit,
- UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME "%d", unit);
- if (*dev != NULL) {
- dev_ref(*dev);
- (*dev)->si_flags |= SI_CHEAPCLONE;
- }
- }
+ if (clone_create(&vkbd_dev_clones, &vkbd_dev_cdevsw, &unit, dev, 0))
+ *dev = make_dev_credf(MAKEDEV_REF, &vkbd_dev_cdevsw, unit,
+ cred, UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME "%d",
+ unit);
}
/* Open device */
Modified: head/sys/security/audit/audit_pipe.c
==============================================================================
--- head/sys/security/audit/audit_pipe.c Sat Sep 7 11:41:52 2013 (r255358)
+++ head/sys/security/audit/audit_pipe.c Sat Sep 7 13:45:44 2013 (r255359)
@@ -672,14 +672,9 @@ audit_pipe_clone(void *arg, struct ucred
return;
i = clone_create(&audit_pipe_clones, &audit_pipe_cdevsw, &u, dev, 0);
- if (i) {
- *dev = make_dev(&audit_pipe_cdevsw, u, UID_ROOT,
- GID_WHEEL, 0600, "%s%d", AUDIT_PIPE_NAME, u);
- if (*dev != NULL) {
- dev_ref(*dev);
- (*dev)->si_flags |= SI_CHEAPCLONE;
- }
- }
+ if (i)
+ *dev = make_dev_credf(MAKEDEV_REF, &audit_pipe_cdevsw, u, cred,
+ UID_ROOT, GID_WHEEL, 0600, "%s%d", AUDIT_PIPE_NAME, u);
}
/*
More information about the svn-src-head
mailing list