aboutsummaryrefslogtreecommitdiff
path: root/sys/netsmb
diff options
context:
space:
mode:
authorDavide Italiano <davide@FreeBSD.org>2013-03-09 16:58:19 +0000
committerDavide Italiano <davide@FreeBSD.org>2013-03-09 16:58:19 +0000
commit4036ec8645dd4733e49f30c6d39f4f335d4acb09 (patch)
treed90ce6cdc6e69149c2d2a3bf05547e8c4b91733f /sys/netsmb
parent6ce4aeb88ff6d4bc1847f978f64aa9156fbfe100 (diff)
downloadsrc-4036ec8645dd4733e49f30c6d39f4f335d4acb09.tar.gz
src-4036ec8645dd4733e49f30c6d39f4f335d4acb09.zip
Call make_dev_credf() rather than using the couple make_dev()/dev_ref().
This closes a race with clone_cleanup().
Notes
Notes: svn path=/head/; revision=248109
Diffstat (limited to 'sys/netsmb')
-rw-r--r--sys/netsmb/smb_dev.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c
index a09d74d5f459..5315f3f7a891 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