Message ID | 20180725211509.13592-3-mwilck@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix silent data corruption in blkdev_direct_IO() | expand |
On 07/25/2018 11:15 PM, Martin Wilck wrote: > Fixes: 72ecad22d9f1 ("block: support a full bio worth of IO for > simplified bdev direct-io") > Reviewed-by: Ming Lei <ming.lei@redhat.com> > Signed-off-by: Martin Wilck <mwilck@suse.com> > --- > fs/block_dev.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes
On Wed, Jul 25, 2018 at 11:15:08PM +0200, Martin Wilck wrote: > Fixes: 72ecad22d9f1 ("block: support a full bio worth of IO for > simplified bdev direct-io") > Reviewed-by: Ming Lei <ming.lei@redhat.com> > Signed-off-by: Martin Wilck <mwilck@suse.com> I'm pretty sure I already ACKed this last time, but here we go again: Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/fs/block_dev.c b/fs/block_dev.c index 0dd87aa..aba2541 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -221,7 +221,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, ret = bio_iov_iter_get_pages(&bio, iter); if (unlikely(ret)) - return ret; + goto out; ret = bio.bi_iter.bi_size; if (iov_iter_rw(iter) == READ) { @@ -250,12 +250,13 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, put_page(bvec->bv_page); } - if (vecs != inline_vecs) - kfree(vecs); - if (unlikely(bio.bi_status)) ret = blk_status_to_errno(bio.bi_status); +out: + if (vecs != inline_vecs) + kfree(vecs); + bio_uninit(&bio); return ret;