block: 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")

Signed-off-by: Shaun Tancheff <shaun.tancheff@seagate.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Larry Finger@lwfinger.net
Tested-by: David Drysdale <drysdale@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by Shaun Tancheff and committed by Jens Axboe 05bd92dd 87c279e6

+9 -3
+9 -3
block/blk-lib.c
··· 113 113 ret = submit_bio_wait(type, bio); 114 114 if (ret == -EOPNOTSUPP) 115 115 ret = 0; 116 + bio_put(bio); 116 117 } 117 118 blk_finish_plug(&plug); 118 119 ··· 166 165 } 167 166 } 168 167 169 - if (bio) 168 + if (bio) { 170 169 ret = submit_bio_wait(REQ_WRITE | REQ_WRITE_SAME, bio); 170 + bio_put(bio); 171 + } 171 172 return ret != -EOPNOTSUPP ? ret : 0; 172 173 } 173 174 EXPORT_SYMBOL(blkdev_issue_write_same); ··· 209 206 } 210 207 } 211 208 212 - if (bio) 213 - return submit_bio_wait(WRITE, bio); 209 + if (bio) { 210 + ret = submit_bio_wait(WRITE, bio); 211 + bio_put(bio); 212 + return ret; 213 + } 214 214 return 0; 215 215 } 216 216