diff options
author | Muthukumar Ratty <muthur@gmail.com> | 2014-01-08 17:39:49 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2014-01-08 17:39:49 +0100 |
commit | 95d4403889acbd98e06d41a255df76452210996a (patch) | |
tree | 00d606520db8f3ddc6071653caf05f8a7bc52f56 /fs/bio.c | |
parent | blk-mq: fix initializing request's start time (diff) | |
download | linux-95d4403889acbd98e06d41a255df76452210996a.tar.xz linux-95d4403889acbd98e06d41a255df76452210996a.zip |
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>
Diffstat (limited to 'fs/bio.c')
-rw-r--r-- | fs/bio.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1770,6 +1770,15 @@ void bio_endio(struct bio *bio, int error) } else { if (bio->bi_end_io) bio->bi_end_io(bio, error); + else { + char dev_name[BDEVNAME_SIZE]; + + WARN(1, "bio_endio: bio for %s without endio\n", + bio->bi_bdev ? bdevname(bio->bi_bdev, + dev_name) : "(unknown)"); + bio_put(bio); + } + bio = NULL; } } |