This is a note to let you know that I've just added the patch titled open: make RESOLVE_CACHED correctly test for O_TMPFILE to the 6.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: open-make-resolve_cached-correctly-test-for-o_tmpfile.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a0fc452a5d7fed986205539259df1d60546f536c Mon Sep 17 00:00:00 2001 From: Aleksa Sarai <cyphar@xxxxxxxxxx> Date: Sun, 6 Aug 2023 02:11:58 +1000 Subject: open: make RESOLVE_CACHED correctly test for O_TMPFILE From: Aleksa Sarai <cyphar@xxxxxxxxxx> commit a0fc452a5d7fed986205539259df1d60546f536c 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@xxxxxxxxxxxxxxx # v5.12+ Fixes: 99668f618062 ("fs: expose LOOKUP_CACHED through openat2() RESOLVE_CACHED") Signed-off-by: Aleksa Sarai <cyphar@xxxxxxxxxx> Message-Id: <20230806-resolve_cached-o_tmpfile-v1-1-7ba16308465e@xxxxxxxxxx> Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/open.c +++ b/fs/open.c @@ -1271,7 +1271,7 @@ inline int build_open_flags(const struct lookup_flags |= LOOKUP_IN_ROOT; if (how->resolve & RESOLVE_CACHED) { /* Don't bother even trying for create/truncate/tmpfile open */ - if (flags & (O_TRUNC | O_CREAT | O_TMPFILE)) + if (flags & (O_TRUNC | O_CREAT | __O_TMPFILE)) return -EAGAIN; lookup_flags |= LOOKUP_CACHED; } Patches currently in stable-queue which might be from cyphar@xxxxxxxxxx are queue-6.4/open-make-resolve_cached-correctly-test-for-o_tmpfile.patch