Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2011 11:14:27 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222283 - head/sys/geom/vinum
Message-ID:  <201105251114.p4PBERhH012717@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed May 25 11:14:26 2011
New Revision: 222283
URL: http://svn.freebsd.org/changeset/base/222283

Log:
  Prevent non-aligned reading from provider while tasting. Reject
  providers with unsupported sectorsize.
  
  Reported by:	Joerg Wunsch
  MFC after:	1 week

Modified:
  head/sys/geom/vinum/geom_vinum_drive.c
  head/sys/geom/vinum/geom_vinum_events.c

Modified: head/sys/geom/vinum/geom_vinum_drive.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_drive.c	Wed May 25 10:04:13 2011	(r222282)
+++ head/sys/geom/vinum/geom_vinum_drive.c	Wed May 25 11:14:26 2011	(r222283)
@@ -126,6 +126,10 @@ gv_read_header(struct g_consumer *cp, st
 	pp = cp->provider;
 	KASSERT(pp != NULL, ("gv_read_header: null pp"));
 
+	if ((GV_HDR_OFFSET % pp->sectorsize) != 0 ||
+	    (GV_HDR_LEN % pp->sectorsize) != 0)
+		return (ENODEV);
+
 	d_hdr = g_read_data(cp, GV_HDR_OFFSET, pp->sectorsize, NULL);
 	if (d_hdr == NULL)
 		return (-1);

Modified: head/sys/geom/vinum/geom_vinum_events.c
==============================================================================
--- head/sys/geom/vinum/geom_vinum_events.c	Wed May 25 10:04:13 2011	(r222282)
+++ head/sys/geom/vinum/geom_vinum_events.c	Wed May 25 11:14:26 2011	(r222283)
@@ -109,6 +109,12 @@ gv_drive_tasted(struct gv_softc *sc, str
 	buf = NULL;
 
 	G_VINUM_DEBUG(2, "tasted drive on '%s'", pp->name);
+	if ((GV_CFG_OFFSET % pp->sectorsize) != 0 ||
+	    (GV_CFG_LEN % pp->sectorsize) != 0) {
+		G_VINUM_DEBUG(0, "provider %s has unsupported sectorsize.",
+		    pp->name);
+		return;
+	}
 
 	gp = sc->geom;
 	g_topology_lock();



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