Fix reported kmemleak
Subsystems (2)
PATCH 1/1 Fix reported kmemleak
This fixes a memory leak reported by a few people in 4.7-rc1
kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
This patch just formalizes the one in this discussion here:
https://lkml.kernel.org/r/[email protected]
The same issue appears here:
https://lkml.kernel.org/r/[email protected]
Patch is also available at:
https://github.com/stancheff/linux.git
branch: v4.7-rc2+bio_put
Shaun Tancheff (1):
Missing bio_put following submit_bio_wait
block/blk-lib.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.8.1
PATCH 1/1 Missing bio_put following submit_bio_wait
submit_bio_wait() gives the caller an opportunity to examine struct bio and so expects the caller to issue the put_bio()
This fixes a memory leak reported by a few people in 4.7-rc2 kmemleak report after 9082e87bfbf8 ("block: remove struct bio_batch")
--- block/blk-lib.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
block/blk-lib.c +9 -3
@@ -113,6 +113,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, ret =submit_bio_wait (type, bio);if (ret == -EOPNOTSUPP ) ret =0 ; +bio_put (bio); }blk_finish_plug (&plug);
@@ -165,8 +166,10 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector, } } -if (bio) +if (bio) { ret =submit_bio_wait (REQ_WRITE |REQ_WRITE_SAME , bio); +bio_put (bio); + }return ret != -EOPNOTSUPP ? ret :0 ; }EXPORT_SYMBOL (blkdev_issue_write_same);
@@ -206,8 +209,11 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, } } -if (bio) -return submit_bio_wait (WRITE , bio); +if (bio) { + ret =submit_bio_wait (WRITE , bio); +bio_put (bio); +return ret; + }return 0 ; }
Signature · 1 line
2.8.1
Re: [PATCH] Missing bio_put following submit_bio_wait
Looks fine,
Re: [PATCH] Missing bio_put following submit_bio_wait
In reply to Shaun TancheffQuoted 10 lines · Shaun Tancheff
submit_bio_wait()gives the caller an opportunity to examine struct bio and so expects the caller to issue theput_bio()This fixes a memory leak reported by a few people in 4.7-rc2 kmemleak report after
9082e87bfbf8("block: remove structbio_batch")Signed-off-by Shaun Tancheff <[email protected]>Tested-by Catalin Marinas <[email protected]>Tested-by Larry [email protected]Tested-by David Drysdale <[email protected]>
Thanks, applied.
Signature · 1 line
Jens Axboe
Hi,
Quoted 12 lines · Shaun Tancheff
This fixes a memory leak reported by a few people in 4.7-rc1
kmemleak report after
9082e87bfbf8("block: remove structbio_batch")This patch just formalizes the one in this discussion here:
https://lkml.kernel.org/r/[email protected]The same issue appears here:
https://lkml.kernel.org/r/[email protected]Patch is also available at:
Quoted 7 lines
https://github.com/stancheff/linux.git
branch: v4.7-rc2+bio_putCc Christoph Hellwig <[email protected]>cc David Drysdale <[email protected]>Cc Xiong Zhou <[email protected]>
Thanks for the information!
Quoted 19 lines
Cc Stephen Rothwell <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Larry Finger <[email protected]>Cc Catalin Marinas <[email protected]>Cc LKML <[email protected]>,Cc Jens Axboe <[email protected]>,Shaun Tancheff (1):
Missingbio_putfollowingsubmit_bio_waitblock/blk-lib.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)Signature · 1 line
2.8.1