]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
VFS/audit: introduce kern_path_parent() for audit
authorNeilBrown <neil@brown.name>
Mon, 22 Sep 2025 04:29:51 +0000 (14:29 +1000)
committerChristian Brauner <brauner@kernel.org>
Tue, 23 Sep 2025 10:37:35 +0000 (12:37 +0200)
commit76a53de6f7ff0641570364234fb4489f4d4fc8e9
tree26f7c0c389ada340201ab498f35241077552328d
parentd7fb2c410240348edee7867c29b60688175dcc11
VFS/audit: introduce kern_path_parent() for audit

audit_alloc_mark() and audit_get_nd() both need to perform a path
lookup getting the parent dentry (which must exist) and the final
target (following a LAST_NORM name) which sometimes doesn't need to
exist.

They don't need the parent to be locked, but use kern_path_locked() or
kern_path_locked_negative() anyway.  This is somewhat misleading to the
casual reader.

This patch introduces a more targeted function, kern_path_parent(),
which returns not holding locks.  On success the "path" will
be set to the parent, which must be found, and the return value is the
dentry of the target, which might be negative.

This will clear the way to rename kern_path_locked() which is
otherwise only used to prepare for removing something.

It also allows us to remove kern_path_locked_negative(), which is
transformed into the new kern_path_parent().

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namei.c
include/linux/namei.h
kernel/audit_fsnotify.c
kernel/audit_watch.c