Author: trociny
Date: Tue Apr 12 09:36:38 2011
New Revision: 220562
URL: http://svn.freebsd.org/changeset/base/220562

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 <vic...@bsdes.net> (initial version)
  
  Tested by:    Oliver Pinter <oliver.pin...@gmail.com>
  Approved by:  kib (co-mentor)

Modified:
  stable/7/sys/geom/eli/g_eli.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/geom/eli/g_eli.c
==============================================================================
--- stable/7/sys/geom/eli/g_eli.c       Tue Apr 12 08:54:49 2011        
(r220561)
+++ stable/7/sys/geom/eli/g_eli.c       Tue Apr 12 09:36:38 2011        
(r220562)
@@ -153,13 +153,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);
        if (pbp->bio_error != 0) {
                G_ELI_LOGREQ(0, pbp, "%s() failed", __func__);
                pbp->bio_completed = 0;
@@ -193,6 +193,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?
         */
@@ -206,7 +207,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.
         */
_______________________________________________
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