Skip to content

Commit b65e0dd

Browse files
isilenceaxboe
authored andcommitted
io_uring: mark ->work uninitialised after cleanup
Remove REQ_F_WORK_INITIALIZED after io_req_clean_work(). That's a cold path but is safer for those using io_req_clean_work() out of *dismantle_req()/*io_free(). And for the same reason zero work.fs Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent f56040b commit b65e0dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/io_uring.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,9 @@ static void io_req_clean_work(struct io_kiocb *req)
11411141
spin_unlock(&req->work.fs->lock);
11421142
if (fs)
11431143
free_fs_struct(fs);
1144+
req->work.fs = NULL;
11441145
}
1146+
req->flags &= ~REQ_F_WORK_INITIALIZED;
11451147
}
11461148

11471149
static void io_prep_async_work(struct io_kiocb *req)
@@ -4969,7 +4971,6 @@ static int io_poll_add(struct io_kiocb *req)
49694971

49704972
/* ->work is in union with hash_node and others */
49714973
io_req_clean_work(req);
4972-
req->flags &= ~REQ_F_WORK_INITIALIZED;
49734974

49744975
INIT_HLIST_NODE(&req->hash_node);
49754976
ipt.pt._qproc = io_poll_queue_proc;

0 commit comments

Comments
 (0)