Skip to content

Commit 5907532

Browse files
committed
io_uring/futex: ensure io_futex_wait() cleans up properly on failure
jira LE-4311 cve CVE-2025-39698 Rebuild_History Non-Buildable kernel-5.14.0-570.49.1.el9_6 commit-author Jens Axboe <axboe@kernel.dk> commit 508c131 The io_futex_data is allocated upfront and assigned to the io_kiocb async_data field, but the request isn't marked with REQ_F_ASYNC_DATA at that point. Those two should always go together, as the flag tells io_uring whether the field is valid or not. Additionally, on failure cleanup, the futex handler frees the data but does not clear ->async_data. Clear the data and the flag in the error path as well. Thanks to Trend Micro Zero Day Initiative and particularly ReDress for reporting this. Cc: stable@vger.kernel.org Fixes: 194bb58 ("io_uring: add support for futex wake and wait") Signed-off-by: Jens Axboe <axboe@kernel.dk> (cherry picked from commit 508c131) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 64250b7 commit 5907532

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

io_uring/futex.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags)
337337
goto done_unlock;
338338
}
339339

340+
req->flags |= REQ_F_ASYNC_DATA;
340341
req->async_data = ifd;
341342
ifd->q = futex_q_init;
342343
ifd->q.bitset = iof->futex_mask;
@@ -359,6 +360,8 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags)
359360
if (ret < 0)
360361
req_set_fail(req);
361362
io_req_set_res(req, ret, 0);
363+
req->async_data = NULL;
364+
req->flags &= ~REQ_F_ASYNC_DATA;
362365
kfree(ifd);
363366
return IOU_OK;
364367
}

0 commit comments

Comments
 (0)