]> git.ipfire.org Git - thirdparty/linux.git/commit
vfs: call audit_inode_child() in lookup_open() on failure
authorJori Koolstra <jkoolstra@xs4all.nl>
Fri, 10 Jul 2026 16:42:32 +0000 (18:42 +0200)
committerChristian Brauner <brauner@kernel.org>
Thu, 30 Jul 2026 10:16:56 +0000 (12:16 +0200)
commit4886c80eef20c72757c584af2f93d26a3b021c6c
tree40fe1ee63a7b2a3dc7acc545ea2958309e663814
parent4d315e54aa898ea491ce2fe72ee482f74b7ba84a
vfs: call audit_inode_child() in lookup_open() on failure

audit_inode_child() is called in may_create_dentry() so that failed
filesystem operations still register an audit entry. On success, the
entry is overwritten when, for instance, fsnotify_create() is called.
This is the calling convention in vfs_create() and vfs_mkdir().
In lookup_open(), however, when atomic_open() should have created a
file but didn't, no call to audit_inode_child() is made. The same is
true for the regular ->create() path.

Fix the calling of audit_inode_child() in lookup_open() to match the
vfs_create() path. For the ->atomic_open() filesystems this logic has
been pushed into atomic_open(). This function is also reordered a bit
to make the case distinction of the possible returns from
->atomic_open() more explicit (i.e. finish_open() or finish_no_open()).

When retrying delegation breaking, audit_inode_child() could be called
more than once, but this is OK because those entries are reused.

Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260710164233.827744-3-jkoolstra@xs4all.nl
Acked-by: Paul Moore (audit) <paul@paul-moore.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/namei.c