From owner-svn-src-all@FreeBSD.ORG Sat Sep 7 13:45:46 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 03A54D41; Sat, 7 Sep 2013 13:45:46 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E473D2213; Sat, 7 Sep 2013 13:45:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r87Djjp7003444; Sat, 7 Sep 2013 13:45:45 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r87Djj0P003439; Sat, 7 Sep 2013 13:45:45 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201309071345.r87Djj0P003439@svn.freebsd.org> From: Davide Italiano Date: Sat, 7 Sep 2013 13:45:45 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 13:45:46 -0000 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); } /*