From owner-svn-src-all@FreeBSD.ORG Sun Apr 10 19:31:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C7E0106564A; Sun, 10 Apr 2011 19:31:01 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F043D8FC1A; Sun, 10 Apr 2011 19:31:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3AJV0CZ057205; Sun, 10 Apr 2011 19:31:00 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3AJV00f057203; Sun, 10 Apr 2011 19:31:00 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201104101931.p3AJV00f057203@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 10 Apr 2011 19:31:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220529 - stable/8/sys/geom/eli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Apr 2011 19:31:01 -0000 Author: trociny Date: Sun Apr 10 19:31:00 2011 New Revision: 220529 URL: http://svn.freebsd.org/changeset/base/220529 Log: MFC r220299: In g_eli_read_done() and g_eli_write_done(), for a bio with bio_children > 1, g_destroy_bio() is never called and the bio leaks. Fix this by calling g_destroy_bio() earlier, before the check. Submitted by: Victor Balada Diaz (initial version) Approved by: pjd (mentor) Modified: stable/8/sys/geom/eli/g_eli.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/eli/g_eli.c ============================================================================== --- stable/8/sys/geom/eli/g_eli.c Sun Apr 10 18:36:24 2011 (r220528) +++ stable/8/sys/geom/eli/g_eli.c Sun Apr 10 19:31:00 2011 (r220529) @@ -160,13 +160,13 @@ g_eli_read_done(struct bio *bp) pbp = bp->bio_parent; if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; + g_destroy_bio(bp); /* * Do we have all sectors already? */ pbp->bio_inbed++; if (pbp->bio_inbed < pbp->bio_children) return; - g_destroy_bio(bp); sc = pbp->bio_to->geom->softc; if (pbp->bio_error != 0) { G_ELI_LOGREQ(0, pbp, "%s() failed", __func__); @@ -202,6 +202,7 @@ g_eli_write_done(struct bio *bp) if (bp->bio_error != 0) pbp->bio_error = bp->bio_error; } + g_destroy_bio(bp); /* * Do we have all sectors already? */ @@ -215,7 +216,6 @@ g_eli_write_done(struct bio *bp) pbp->bio_error); pbp->bio_completed = 0; } - g_destroy_bio(bp); /* * Write is finished, send it up. */