Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2013 18:07:44 +0000 (UTC)
From:      Jean-Sebastien Pedron <dumbbell@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r248058 - head/sys/geom/label
Message-ID:  <201303081807.r28I7id2006737@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dumbbell
Date: Fri Mar  8 18:07:43 2013
New Revision: 248058
URL: http://svnweb.freebsd.org/changeset/base/248058

Log:
  g_label_ntfs_taste: Abort taste is recsize == 0
  
  This will avoid a 0-byte read (in g_read_data()) leading to a panic, if
  previously read data are erroneous.
  
  Suggested by:	John-Mark Gurney <jmg@funkthat.com>

Modified:
  head/sys/geom/label/g_label_ntfs.c

Modified: head/sys/geom/label/g_label_ntfs.c
==============================================================================
--- head/sys/geom/label/g_label_ntfs.c	Fri Mar  8 17:28:40 2013	(r248057)
+++ head/sys/geom/label/g_label_ntfs.c	Fri Mar  8 18:07:43 2013	(r248058)
@@ -115,7 +115,7 @@ g_label_ntfs_taste(struct g_consumer *cp
 
 	mftrecsz = (char)bf->bf_mftrecsz;
 	recsize = (mftrecsz > 0) ? (mftrecsz * bf->bf_bps * bf->bf_spc) : (1 << -mftrecsz);
-	if (recsize % pp->sectorsize != 0)
+	if (recsize == 0 || recsize % pp->sectorsize != 0)
 		goto done;
 
 	voloff = bf->bf_mftcn * bf->bf_spc * bf->bf_bps +



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