Skip to content

Commit

Permalink
io_uring: fix fs cleanup on cqe overflow
Browse files Browse the repository at this point in the history
If completion queue overflow occurs, __io_cqring_fill_event() will
update req->cflags, which is in a union with req->work and happens to
be aliased to req->work.fs. Following io_free_req() ->
io_req_work_drop_env() may get a bunch of different problems (miscount
fs->users, segfault, etc) on cleaning @fs.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Pavel Begunkov authored and Jens Axboe committed Apr 9, 2020
1 parent 9c280f9 commit c398ecb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ struct io_kiocb {
};

struct io_async_ctx *io;
int cflags;
bool needs_fixed_file;
u8 opcode;

Expand Down Expand Up @@ -638,7 +639,6 @@ struct io_kiocb {
struct callback_head task_work;
struct hlist_node hash_node;
struct async_poll *apoll;
int cflags;
};
struct io_wq_work work;
};
Expand Down

0 comments on commit c398ecb

Please sign in to comment.