In vn_isdisk(), check whether vp->v_rdev is NULL. If it is, then

return ENXIO (Device not configured).  Without this, vn_isdisk()
could (and did in the case of lstat() under fdesc) pass a NULL pointer
to devsw(), which caused a page fault.

Reviewed by:	alfred
This commit is contained in:
Chris Costello 2000-03-18 01:27:44 +00:00
parent 686ed81847
commit b081a64afb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=58185
2 changed files with 10 additions and 0 deletions

View file

@ -2909,6 +2909,11 @@ vn_isdisk(vp, errp)
*errp = ENOTBLK;
return (0);
}
if (vp->v_rdev == NULL) {
if (errp != NULL)
*errp = ENXIO;
return (0);
}
if (!devsw(vp->v_rdev)) {
if (errp != NULL)
*errp = ENXIO;

View file

@ -2909,6 +2909,11 @@ vn_isdisk(vp, errp)
*errp = ENOTBLK;
return (0);
}
if (vp->v_rdev == NULL) {
if (errp != NULL)
*errp = ENXIO;
return (0);
}
if (!devsw(vp->v_rdev)) {
if (errp != NULL)
*errp = ENXIO;