Call make_dev_credf() rather than using the couple make_dev()/dev_ref().

This closes a race with clone_cleanup().
This commit is contained in:
Davide Italiano 2013-03-09 16:58:19 +00:00
parent 6ce4aeb88f
commit 4036ec8645
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248109

View file

@ -107,14 +107,9 @@ nsmb_dev_clone(void *arg, struct ucred *cred, char *name, int namelen,
else if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1)
return;
i = clone_create(&nsmb_clones, &nsmb_cdevsw, &u, dev, 0);
if (i) {
*dev = make_dev(&nsmb_cdevsw, u, UID_ROOT, GID_WHEEL, 0600,
"%s%d", NSMB_NAME, u);
if (*dev != NULL) {
dev_ref(*dev);
(*dev)->si_flags |= SI_CHEAPCLONE;
}
}
if (i)
*dev = make_dev_credf(MAKEDEV_REF, &nsmb_cdevsw, u, cred,
UID_ROOT, GID_WHEEL, 0600, "%s%d", NSMB_NAME, u);
}
static int