mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
- 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
This commit is contained in:
parent
550ac4a8e8
commit
d56b4cd4ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255359
@ -52,10 +52,6 @@ dtrace_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
@ -992,11 +992,9 @@ fwdev_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
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;
|
||||
}
|
||||
|
@ -186,14 +186,10 @@ vkbd_dev_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
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 */
|
||||
|
@ -672,14 +672,9 @@ audit_pipe_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user