Skip to content

Commit 5c760d4

Browse files
cypharsmb49
authored andcommitted
open: make RESOLVE_CACHED correctly test for O_TMPFILE
BugLink: https://bugs.launchpad.net/bugs/2038236 commit a0fc452 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 8144941 commit 5c760d4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ inline int build_open_flags(const struct open_how *how, struct open_flags *op)
12331233
lookup_flags |= LOOKUP_IN_ROOT;
12341234
if (how->resolve & RESOLVE_CACHED) {
12351235
/* Don't bother even trying for create/truncate/tmpfile open */
1236-
if (flags & (O_TRUNC | O_CREAT | O_TMPFILE))
1236+
if (flags & (O_TRUNC | O_CREAT | __O_TMPFILE))
12371237
return -EAGAIN;
12381238
lookup_flags |= LOOKUP_CACHED;
12391239
}

0 commit comments

Comments
 (0)