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
5b718312b7
commit
3d3c27fedf
@ -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