svn commit: r326912 - head/usr.sbin/makefs
Mark Johnston
markj at FreeBSD.org
Sat Dec 16 20:19:01 UTC 2017
Author: markj
Date: Sat Dec 16 20:19:00 2017
New Revision: 326912
URL: https://svnweb.freebsd.org/changeset/base/326912
Log:
Fix a logic bug in makefs lazy inode initialization.
We may need to initialize multiple inode blocks before writing a given
inode. makefs(8) was only initializing a single block at a time, so
certain inode allocation patterns could lead to a situation where it
wrote an inode to an uninitialized block. That inode might be clobbered
by a later initialization, resulting in a filesystem image containing
directory entries that point to a seemingly unused inode.
Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13505
Modified:
head/usr.sbin/makefs/ffs.c
Modified: head/usr.sbin/makefs/ffs.c
==============================================================================
--- head/usr.sbin/makefs/ffs.c Sat Dec 16 19:40:28 2017 (r326911)
+++ head/usr.sbin/makefs/ffs.c Sat Dec 16 20:19:00 2017 (r326912)
@@ -1130,7 +1130,7 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const
* Initialize inode blocks on the fly for UFS2.
*/
initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap);
- if (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk &&
+ while (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk &&
initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) {
memset(buf, 0, fs->fs_bsize);
dip = (struct ufs2_dinode *)buf;
More information about the svn-src-head
mailing list