From owner-svn-src-head@FreeBSD.ORG Wed May 25 11:14:27 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47D87106564A; Wed, 25 May 2011 11:14:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 396BC8FC13; Wed, 25 May 2011 11:14:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4PBERqj012720; Wed, 25 May 2011 11:14:27 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4PBERhH012717; Wed, 25 May 2011 11:14:27 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201105251114.p4PBERhH012717@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 25 May 2011 11:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222283 - head/sys/geom/vinum X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2011 11:14:27 -0000 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();