Skip to content

Commit a0fc452

Browse files
cypharbrauner
authored andcommitted
open: make RESOLVE_CACHED correctly test for O_TMPFILE
O_TMPFILE is actually __O_TMPFILE|O_DIRECTORY. This means that the old fast-path check for RESOLVE_CACHED would reject all users passing O_DIRECTORY with -EAGAIN, when in fact the intended test was to check for __O_TMPFILE. Cc: stable@vger.kernel.org # v5.12+ Fixes: 99668f6 ("fs: expose LOOKUP_CACHED through openat2() RESOLVE_CACHED") Signed-off-by: Aleksa Sarai <cyphar@cyphar.com> Message-Id: <20230806-resolve_cached-o_tmpfile-v1-1-7ba16308465e@cyphar.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 024ff30 commit a0fc452

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ inline int build_open_flags(const struct open_how *how, struct open_flags *op)
13221322
lookup_flags |= LOOKUP_IN_ROOT;
13231323
if (how->resolve & RESOLVE_CACHED) {
13241324
/* Don't bother even trying for create/truncate/tmpfile open */
1325-
if (flags & (O_TRUNC | O_CREAT | O_TMPFILE))
1325+
if (flags & (O_TRUNC | O_CREAT | __O_TMPFILE))
13261326
return -EAGAIN;
13271327
lookup_flags |= LOOKUP_CACHED;
13281328
}

0 commit comments

Comments
 (0)