Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Dec 2017 20:19:00 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326912 - head/usr.sbin/makefs
Message-ID:  <201712162019.vBGKJ0KZ070891@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712162019.vBGKJ0KZ070891>