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();
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to