summaryrefslogtreecommitdiffstats
path: root/sys/geom/eli/g_eli.c
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2011-04-03 17:38:12 +0000
committertrociny <trociny@FreeBSD.org>2011-04-03 17:38:12 +0000
commite95ea389566188409a5acd3a88207d354b098ec5 (patch)
treebacca279c72fc9213626c6b36c3ff72b61a54516 /sys/geom/eli/g_eli.c
parentdd70a45751d7a32ce092ffaae6154831c4431ac4 (diff)
downloadFreeBSD-src-e95ea389566188409a5acd3a88207d354b098ec5.zip
FreeBSD-src-e95ea389566188409a5acd3a88207d354b098ec5.tar.gz
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 <victor@bsdes.net> (initial version) Approved by: pjd (mentor) MFC after: 1 week
Diffstat (limited to 'sys/geom/eli/g_eli.c')
-rw-r--r--sys/geom/eli/g_eli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c
index 0dd0d0c..9f712cf 100644
--- a/sys/geom/eli/g_eli.c
+++ b/sys/geom/eli/g_eli.c
@@ -161,13 +161,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__);
@@ -203,6 +203,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?
*/
@@ -216,7 +217,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.
*/
OpenPOWER on IntegriCloud