Skip to content

Commit c398ecb

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix fs cleanup on cqe overflow
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 9c280f9 commit c398ecb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ struct io_kiocb {
608608
};
609609

610610
struct io_async_ctx *io;
611+
int cflags;
611612
bool needs_fixed_file;
612613
u8 opcode;
613614

@@ -638,7 +639,6 @@ struct io_kiocb {
638639
struct callback_head task_work;
639640
struct hlist_node hash_node;
640641
struct async_poll *apoll;
641-
int cflags;
642642
};
643643
struct io_wq_work work;
644644
};

0 commit comments

Comments
 (0)