Add early checks for MNT_ROOTFS since we need to allow it later on in

the code path.
This commit is contained in:
Poul-Henning Kamp 2004-12-03 19:25:44 +00:00
parent a08805c741
commit 2a8b79eb6a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138357

View File

@ -389,6 +389,10 @@ nmount(td, uap)
int error; int error;
u_int iovcnt; u_int iovcnt;
/* Kick out MNT_ROOTFS early as it is legal internally */
if (uap->flags & MNT_ROOTFS)
return (EINVAL);
iovcnt = uap->iovcnt; iovcnt = uap->iovcnt;
/* /*
* Check that we have an even number of iovec's * Check that we have an even number of iovec's
@ -396,6 +400,7 @@ nmount(td, uap)
*/ */
if ((iovcnt & 1) || (iovcnt < 4)) if ((iovcnt & 1) || (iovcnt < 4))
return (EINVAL); return (EINVAL);
error = copyinuio(uap->iovp, iovcnt, &auio); error = copyinuio(uap->iovp, iovcnt, &auio);
if (error) if (error)
return (error); return (error);
@ -610,6 +615,10 @@ mount(td, uap)
char *fspath; char *fspath;
int error; int error;
/* Kick out MNT_ROOTFS early as it is legal internally */
if (uap->flags & MNT_ROOTFS)
return (EINVAL);
fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK); fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK);
fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK); fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK);