diff options
author | kib <kib@FreeBSD.org> | 2015-04-05 21:08:04 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-04-05 21:08:04 +0000 |
commit | 95e51995786685d7cceb893fae4a6c359ce7aee9 (patch) | |
tree | d28d9eb46722557355fc5463db82fa99246bce40 | |
parent | 61ea198b48019b613bba16ef45cd70793cb19295 (diff) | |
download | FreeBSD-src-95e51995786685d7cceb893fae4a6c359ce7aee9.zip FreeBSD-src-95e51995786685d7cceb893fae4a6c359ce7aee9.tar.gz |
Assert that an msdosfs mount is not read-only when FAT modifications
are requested.
PR: 199152
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
-rw-r--r-- | sys/fs/msdosfs/msdosfs_fat.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index 3c17f00..cf03e00 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -380,6 +380,8 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn) MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, + ("usemap_alloc on ro msdosfs mount")); KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); @@ -394,6 +396,8 @@ usemap_free(struct msdosfsmount *pmp, u_long cn) { MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, + ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; pmp->pm_flags |= MSDOSFS_FSIMOD; KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) @@ -675,6 +679,8 @@ chainalloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long cl, n; MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, + ("chainalloc on ro msdosfs mount")); for (cl = start, n = count; n-- > 0;) usemap_alloc(pmp, cl++); |