svn commit: r201711 - stable/7/sbin/fsck_ffs

Xin LI delphij at FreeBSD.org
Thu Jan 7 01:55:34 UTC 2010


Author: delphij
Date: Thu Jan  7 01:55:34 2010
New Revision: 201711
URL: http://svn.freebsd.org/changeset/base/201711

Log:
  MFC r176575:
  
  In pass1(), cap inosused to fs_ipg rather than allowing arbitrary
  number read from cylinder group.  Chances that we read a smarshed
  cylinder group, and we can not 100% trust information it has
  supplied.  fsck_ffs(8) will crash otherwise for some cases.
  
  PR:		bin/138043
  Reminded by:	mckusick

Modified:
  stable/7/sbin/fsck_ffs/pass1.c
Directory Properties:
  stable/7/sbin/fsck_ffs/   (props changed)

Modified: stable/7/sbin/fsck_ffs/pass1.c
==============================================================================
--- stable/7/sbin/fsck_ffs/pass1.c	Thu Jan  7 01:24:09 2010	(r201710)
+++ stable/7/sbin/fsck_ffs/pass1.c	Thu Jan  7 01:55:34 2010	(r201711)
@@ -93,9 +93,11 @@ pass1(void)
 		inumber = c * sblock.fs_ipg;
 		setinodebuf(inumber);
 		getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
-		if (sblock.fs_magic == FS_UFS2_MAGIC)
+		if (sblock.fs_magic == FS_UFS2_MAGIC) {
 			inosused = cgrp.cg_initediblk;
-		else
+			if (inosused > sblock.fs_ipg)
+				inosused = sblock.fs_ipg;
+		} else
 			inosused = sblock.fs_ipg;
 		if (got_siginfo) {
 			printf("%s: phase 1: cyl group %d of %d (%d%%)\n",


More information about the svn-src-stable-7 mailing list