Date: Sat, 7 Sep 2013 13:45:45 +0000 (UTC) From: Davide Italiano <davide@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255359 - in head/sys: cddl/dev/dtrace dev/firewire dev/vkbd security/audit Message-ID: <201309071345.r87Djj0P003439@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309071345.r87Djj0P003439>