Skip to content

Commit 72dbde0

Browse files
cypharaxboe
authored andcommitted
io_uring: correct check for O_TMPFILE
O_TMPFILE is actually __O_TMPFILE|O_DIRECTORY. This means that the old check for whether RESOLVE_CACHED can be used would incorrectly think that O_DIRECTORY could not be used with RESOLVE_CACHED. Cc: stable@vger.kernel.org # v5.12+ Fixes: 3a81fd0 ("io_uring: enable LOOKUP_CACHED path resolution for filename lookups") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> Link: https://lore.kernel.org/r/20230807-resolve_cached-o_tmpfile-v3-1-e49323e1ef6f@cyphar.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 52a93d3 commit 72dbde0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

io_uring/openclose.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ static bool io_openat_force_async(struct io_open *open)
3535
{
3636
/*
3737
* Don't bother trying for O_TRUNC, O_CREAT, or O_TMPFILE open,
38-
* it'll always -EAGAIN
38+
* it'll always -EAGAIN. Note that we test for __O_TMPFILE because
39+
* O_TMPFILE includes O_DIRECTORY, which isn't a flag we need to force
40+
* async for.
3941
*/
40-
return open->how.flags & (O_TRUNC | O_CREAT | O_TMPFILE);
42+
return open->how.flags & (O_TRUNC | O_CREAT | __O_TMPFILE);
4143
}
4244

4345
static int __io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)

0 commit comments

Comments
 (0)