mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
msdosfs: on integrity error, fire a task to remount filesystem to ro
In collaboration with: pho Reviewed by: markj, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721
This commit is contained in:
parent
b2e4b63584
commit
41e85eeab9
3 changed files with 7 additions and 1 deletions
|
|
@ -158,6 +158,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
|
|||
badoff:
|
||||
vgone(nvp);
|
||||
vput(nvp);
|
||||
msdosfs_integrity_error(pmp);
|
||||
return (EBADF);
|
||||
}
|
||||
ldep = malloc(sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK | M_ZERO);
|
||||
|
|
|
|||
|
|
@ -412,6 +412,7 @@ usemap_free(struct msdosfsmount *pmp, u_long cn)
|
|||
printf("%s: Freeing unused sector %ld %ld %x\n",
|
||||
pmp->pm_mountp->mnt_stat.f_mntonname, cn, cn % N_INUSEBITS,
|
||||
(unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]);
|
||||
msdosfs_integrity_error(pmp);
|
||||
return (EINTEGRITY);
|
||||
}
|
||||
pmp->pm_freeclustercount++;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ msdosfs_lookup_checker(struct msdosfsmount *pmp, struct vnode *dvp,
|
|||
*/
|
||||
if (vp == dvp) {
|
||||
vput(vp);
|
||||
msdosfs_integrity_error(pmp);
|
||||
*vpp = NULL;
|
||||
return (EBADF);
|
||||
}
|
||||
|
|
@ -595,10 +596,13 @@ foundroot:
|
|||
vput(*vpp);
|
||||
goto restart;
|
||||
}
|
||||
return (msdosfs_lookup_checker(pmp, vdp, VTODE(*vpp), vpp));
|
||||
error = msdosfs_lookup_checker(pmp, vdp, VTODE(*vpp), vpp);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
} else if (dp->de_StartCluster == scn && isadir) {
|
||||
if (cnp->cn_namelen != 1 || cnp->cn_nameptr[0] != '.') {
|
||||
/* fs is corrupted, non-dot lookup returned dvp */
|
||||
msdosfs_integrity_error(pmp);
|
||||
return (EBADF);
|
||||
}
|
||||
VREF(vdp); /* we want ourself, ie "." */
|
||||
|
|
|
|||
Loading…
Reference in a new issue