[PATCH -next -v4 08/17] LSM: rename inode_setattr to path_setattr and pass struct path and file
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Nov 17 15:11:02 UTC 2026
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] fs: missing struct file propagation to notify_change_target()
--
commit 283fceee103640c180b1123a9a7934aad545e43c
Author: Cai Xinchen <caixinchen1 at huawei.com>
LSM: rename inode_setattr to path_setattr and pass struct path and file
This commit renames the inode_setattr LSM hook to path_setattr and passes
the caller's struct path, target dentry, and optional struct file through
notify_change() and notify_change_target().
> diff --git a/fs/ntfs/named_stream.c b/fs/ntfs/named_stream.c
> index 1c55588df5ba0..05cac62fca1d2 100644
> --- a/fs/ntfs/named_stream.c
> +++ b/fs/ntfs/named_stream.c
> @@ -901,7 +901,8 @@ static int ntfs_stream_setattr_common(const struct mnt_idmap *idmap,
> err = -EINVAL;
> } else {
> err = notify_change_target(idmap, attr->ia_path,
> - base_dentry, &base_attr, NULL);
> + base_dentry, &base_attr,
> + NULL, NULL);
> }
> } else {
> err = 0;
[Severity: Medium]
Does forwarding an attribute change from an NTFS named stream to its base
inode drop the caller's struct file?
do_notify_change() stashes path in attr->ia_path before calling
->setattr(), but does not record file, and ntfs_stream_setattr_common()
passes NULL for file to notify_change_target(). When fchmod(), fchown(),
or futimens() is called on an open named stream fd, the second
security_path_setattr() call on base_dentry runs with file == NULL, so
LSMs and BPF LSM programs treat the forwarded check as a path-based
operation evaluated against current rather than the open file.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117150542.1169451-1-caixinchen1@huawei.com?part=8
More information about the Linux-security-module-archive
mailing list