Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Mar 2014 01:28:22 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263062 - head/sbin/fsck_ffs
Message-ID:  <201403120128.s2C1SMlY097009@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mckusick
Date: Wed Mar 12 01:28:21 2014
New Revision: 263062
URL: http://svnweb.freebsd.org/changeset/base/263062

Log:
  Avoid segment fault when attempting to clean up cylinder group
  buffer cache.
  
  PR:		187221
  Submitted by:	Petr Lampa <lampa@fit.vutbr.cz>
  Obtained from:	Petr Lampa <lampa@fit.vutbr.cz>
  MFC after:	1 week

Modified:
  head/sbin/fsck_ffs/fsutil.c

Modified: head/sbin/fsck_ffs/fsutil.c
==============================================================================
--- head/sbin/fsck_ffs/fsutil.c	Tue Mar 11 23:54:13 2014	(r263061)
+++ head/sbin/fsck_ffs/fsutil.c	Wed Mar 12 01:28:21 2014	(r263062)
@@ -436,13 +436,15 @@ ckfini(int markclean)
 	}
 	if (numbufs != cnt)
 		errx(EEXIT, "panic: lost %d buffers", numbufs - cnt);
-	for (cnt = 0; cnt < sblock.fs_ncg; cnt++) {
-		if (cgbufs[cnt].b_un.b_cg == NULL)
-			continue;
-		flush(fswritefd, &cgbufs[cnt]);
-		free(cgbufs[cnt].b_un.b_cg);
+	if (cgbufs != NULL) {
+		for (cnt = 0; cnt < sblock.fs_ncg; cnt++) {
+			if (cgbufs[cnt].b_un.b_cg == NULL)
+				continue;
+			flush(fswritefd, &cgbufs[cnt]);
+			free(cgbufs[cnt].b_un.b_cg);
+		}
+		free(cgbufs);
 	}
-	free(cgbufs);
 	pbp = pdirbp = (struct bufarea *)0;
 	if (cursnapshot == 0 && sblock.fs_clean != markclean) {
 		if ((sblock.fs_clean = markclean) != 0) {



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