Skip to content

Commit 50176dd

Browse files
Seth ForsheeChristoph Hellwig
authored andcommitted
hfsplus: add missing call to bio_put()
hfsplus leaks bio objects by failing to call bio_put() on the bios it allocates. Add the missing call to fix the leak. Signed-off-by: Seth Forshee <[email protected]> Cc: <[email protected]> # .38.x, .39.x Signed-off-by: Christoph Hellwig <[email protected]>
1 parent ca56a95 commit 50176dd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/hfsplus/wrapper.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int hfsplus_submit_bio(struct block_device *bdev, sector_t sector,
3636
{
3737
DECLARE_COMPLETION_ONSTACK(wait);
3838
struct bio *bio;
39+
int ret = 0;
3940

4041
bio = bio_alloc(GFP_NOIO, 1);
4142
bio->bi_sector = sector;
@@ -54,8 +55,10 @@ int hfsplus_submit_bio(struct block_device *bdev, sector_t sector,
5455
wait_for_completion(&wait);
5556

5657
if (!bio_flagged(bio, BIO_UPTODATE))
57-
return -EIO;
58-
return 0;
58+
ret = -EIO;
59+
60+
bio_put(bio);
61+
return ret;
5962
}
6063

6164
static int hfsplus_read_mdb(void *bufptr, struct hfsplus_wd *wd)

0 commit comments

Comments
 (0)