diff options
author | Shaohua Li | 2017-09-01 11:15:17 -0700 |
---|---|---|
committer | Jens Axboe | 2017-09-01 13:57:33 -0600 |
commit | 92d773324b7edbd36bf0c28c1e0157763aeccc92 (patch) | |
tree | 333db14ef4338ba1daa5063535730c9c3ea3b0d9 /drivers/block/loop.h | |
parent | 12cd3a2fe3ba6d1a2cf007e4e8dcfbe66d3d0a28 (diff) |
block/loop: fix use after free
lo_rw_aio->call_read_iter->
1 aops->direct_IO
2 iov_iter_revert
lo_rw_aio_complete could happen between 1 and 2, the bio and bvec could
be freed before 2, which accesses bvec.
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/loop.h')
-rw-r--r-- | drivers/block/loop.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/loop.h b/drivers/block/loop.h index 43d20d37b79a..b0ba4a5951c4 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h @@ -68,7 +68,10 @@ struct loop_cmd { struct kthread_work work; struct request *rq; struct list_head list; - bool use_aio; /* use AIO interface to handle I/O */ + union { + bool use_aio; /* use AIO interface to handle I/O */ + atomic_t ref; /* only for aio */ + }; long ret; struct kiocb iocb; struct bio_vec *bvec; |