Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jun 2011 05:03:18 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r222554 - stable/8/sys/geom/vinum
Message-ID:  <201106010503.p5153IZ3054687@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Wed Jun  1 05:03:17 2011
New Revision: 222554
URL: http://svn.freebsd.org/changeset/base/222554

Log:
  MFC r222283:
    Prevent non-aligned reading from provider while tasting. Reject
    providers with unsupported sectorsize.

Modified:
  stable/8/sys/geom/vinum/geom_vinum_drive.c
  stable/8/sys/geom/vinum/geom_vinum_events.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/geom/vinum/geom_vinum_drive.c
==============================================================================
--- stable/8/sys/geom/vinum/geom_vinum_drive.c	Wed Jun  1 01:35:09 2011	(r222553)
+++ stable/8/sys/geom/vinum/geom_vinum_drive.c	Wed Jun  1 05:03:17 2011	(r222554)
@@ -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: stable/8/sys/geom/vinum/geom_vinum_events.c
==============================================================================
--- stable/8/sys/geom/vinum/geom_vinum_events.c	Wed Jun  1 01:35:09 2011	(r222553)
+++ stable/8/sys/geom/vinum/geom_vinum_events.c	Wed Jun  1 05:03:17 2011	(r222554)
@@ -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?201106010503.p5153IZ3054687>