linux/fs/cachefiles
Marc Dionne 406fad7698
cachefiles: Fix oops in vfs_mkdir from cachefiles_get_directory
Commit c54b386969 ("VFS: Change vfs_mkdir() to return the dentry.")
changed cachefiles_get_directory, replacing "subdir" with a ERR_PTR
from the result of cachefiles_inject_write_error, which is either 0
or some error code.  This causes an oops when the resulting pointer
is passed to vfs_mkdir.

Use a similar pattern to what is used earlier in the function; replace
subdir with either the return value from vfs_mkdir, or the ERR_PTR
of the cachefiles_inject_write_error() return value, but only if it
is non zero.

Fixes: c54b386969 ("VFS: Change vfs_mkdir() to return the dentry.")
cc: netfs@lists.linux.dev
Signed-off-by: Marc Dionne <marc.dionne@auristor.com>
Link: https://lore.kernel.org/r/20250325125905.395372-1-marc.dionne@auristor.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-03-25 14:59:14 +01:00
..
Kconfig netfs, fscache: Combine fscache with netfs 2023-12-24 15:08:46 +00:00
Makefile cachefiles: notify the user daemon when looking up cookie 2022-05-18 00:11:17 +08:00
cache.c cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie() 2024-07-03 10:36:15 +02:00
daemon.c cachefiles: Parse the "secctx" immediately 2024-12-20 22:07:56 +01:00
error_inject.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
interface.c cachefiles: Fix NULL pointer dereference in object->file 2024-11-11 14:39:38 +01:00
internal.h cachefiles: Parse the "secctx" immediately 2024-12-20 22:07:56 +01:00
io.c cachefiles: Add some subrequest tracepoints 2024-12-20 22:34:05 +01:00
key.c cachefiles: Implement key to filename encoding 2022-01-07 13:42:16 +00:00
main.c cachefiles: Implement object lifecycle funcs 2022-01-07 13:42:08 +00:00
namei.c cachefiles: Fix oops in vfs_mkdir from cachefiles_get_directory 2025-03-25 14:59:14 +01:00
ondemand.c make use of anon_inode_getfile_fmode() 2025-02-21 10:25:31 +01:00
security.c cachefiles: Parse the "secctx" immediately 2024-12-20 22:07:56 +01:00
volume.c cachefiles: fix slab-use-after-free in cachefiles_withdraw_cookie() 2024-07-03 10:36:15 +02:00
xattr.c cachefiles: Add auxiliary data trace 2024-12-20 22:34:05 +01:00