Make sure the total number of sectors is not 0 for a vnode-type md to
avoid a division by zero which would occur on open() in this case. Reviewed by: phk
This commit is contained in:
parent
d106b78011
commit
6ba9978f5d
@ -678,6 +678,10 @@ mdcreate_vnode(struct md_ioctl *mdio, struct proc *p)
|
||||
sc->nsect = mdio->md_size;
|
||||
else
|
||||
sc->nsect = vattr.va_size / sc->secsize; /* XXX: round up ? */
|
||||
if (sc->nsect == 0) {
|
||||
(void) vn_close(nd.ni_vp, flags, p->p_ucred, p);
|
||||
return (EINVAL);
|
||||
}
|
||||
error = mdsetcred(sc, p->p_ucred);
|
||||
if (error) {
|
||||
(void) vn_close(nd.ni_vp, flags, p->p_ucred, p);
|
||||
|
Loading…
Reference in New Issue
Block a user