aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuthukumar Ratty <muthur@gmail.com>2014-01-08 11:39:49 -0500
committerJens Axboe <axboe@kernel.dk>2014-01-08 11:39:49 -0500
commit95d4403889acbd98e06d41a255df76452210996a (patch)
tree00d606520db8f3ddc6071653caf05f8a7bc52f56
parent0fec08b4ecfc36fd8a64432343b2964fb86d2675 (diff)
block: Warn and free bio if bi_end_io is not set
In bio_endio if bio doesn't have bi_end_io (should be an error case), we set bio to NULL and continue silently without freeing the bio. It would be good to have a WARN and free the bio to avoid memory leak. Signed-off-by: Muthukumar Ratty <muthur@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/bio.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 75c49a382239..9156bd1f151c 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1770,6 +1770,15 @@ void bio_endio(struct bio *bio, int error)
1770 } else { 1770 } else {
1771 if (bio->bi_end_io) 1771 if (bio->bi_end_io)
1772 bio->bi_end_io(bio, error); 1772 bio->bi_end_io(bio, error);
1773 else {
1774 char dev_name[BDEVNAME_SIZE];
1775
1776 WARN(1, "bio_endio: bio for %s without endio\n",
1777 bio->bi_bdev ? bdevname(bio->bi_bdev,
1778 dev_name) : "(unknown)");
1779 bio_put(bio);
1780 }
1781
1773 bio = NULL; 1782 bio = NULL;
1774 } 1783 }
1775 } 1784 }