diff options
author | davide <davide@FreeBSD.org> | 2013-03-09 16:58:19 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2013-03-09 16:58:19 +0000 |
commit | 210fb477abfdb2536fa65ef75195e9df994416f9 (patch) | |
tree | d90ce6cdc6e69149c2d2a3bf05547e8c4b91733f | |
parent | 7c437f512eeb94b1d81b4c5e5919f759eadddd05 (diff) | |
download | FreeBSD-src-210fb477abfdb2536fa65ef75195e9df994416f9.zip FreeBSD-src-210fb477abfdb2536fa65ef75195e9df994416f9.tar.gz |
Call make_dev_credf() rather than using the couple make_dev()/dev_ref().
This closes a race with clone_cleanup().
-rw-r--r-- | sys/netsmb/smb_dev.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index a09d74d..5315f3f7 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -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 |