From: sashiko-bot@kernel.org
To: "Cai Xinchen" <caixinchen1@huawei.com>
Cc: selinux@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3 stable/linux-6.12.y 1/3] fs: constify file ptr in backing_file accessor helpers
Date: Mon, 29 Jun 2026 07:01:29 +0000 [thread overview]
Message-ID: <20260629070130.0A5AF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260629070338.578858-2-caixinchen1@huawei.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The helper backing_file_user_path() accepts a const struct file * but returns a mutable struct path *, breaking full const correctness guarantees.
--
commit aa7c0a70405fd2c0d95c3745c9871a3e87c26cc3
Author: Amir Goldstein <amir73il@gmail.com>
fs: constify file ptr in backing_file accessor helpers
This commit introduces backing_file_set_user_path() to handle modifications
to backing_file fields and constifies the file pointer in the backing_file
accessor helpers.
Link: https://lore.kernel.org/20250607115304.2521155-2-amir73il@gmail.com
> diff --git a/fs/file_table.c b/fs/file_table.c
> index 2a08bc93b0b9c..75a1908d51a9f 100644
> --- a/fs/file_table.c
> +++ b/fs/file_table.c
[ ... ]
> -struct path *backing_file_user_path(struct file *f)
> +struct path *backing_file_user_path(const struct file *f)
> {
> return &backing_file(f)->user_path;
> }
[Severity: Low]
Does this inadvertently strip the constness of the input parameter by
returning a mutable pointer to the internal state?
Since the stated goal of the patch is to constify the file pointer in these
accessor helpers, should the return type also be updated to
const struct path * to enforce full const correctness? Returning a mutable
pointer from a const object could enable unintended modifications.
> EXPORT_SYMBOL_GPL(backing_file_user_path);
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 87720e1b54192..70bbc00a2bd25 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
[ ... ]
> @@ -2738,7 +2738,7 @@ struct file *dentry_open(const struct path *path, int flags,
> const struct cred *creds);
> struct file *dentry_create(const struct path *path, int flags, umode_t mode,
> const struct cred *cred);
> -struct path *backing_file_user_path(struct file *f);
> +struct path *backing_file_user_path(const struct file *f);
[Severity: Low]
If backing_file_user_path is updated to return a const struct path *, this
prototype will also need to be adjusted to match.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260629070338.578858-1-caixinchen1@huawei.com?part=1
next prev parent reply other threads:[~2026-06-29 7:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 7:03 [PATCH v3 stable/linux-6.12.y 0/3] Backport Fix incorrect overlayfs mmap() and mprotect() LSM access controls Cai Xinchen
2026-06-29 7:03 ` [PATCH v3 stable/linux-6.12.y 1/3] fs: constify file ptr in backing_file accessor helpers Cai Xinchen
2026-06-29 7:01 ` sashiko-bot [this message]
2026-06-29 7:03 ` [PATCH v3 stable/linux-6.12.y 2/3] lsm: add backing_file LSM hooks Cai Xinchen
2026-06-29 7:06 ` sashiko-bot
2026-06-29 7:03 ` [PATCH v3 stable/linux-6.12.y 3/3] selinux: fix overlayfs mmap() and mprotect() access checks Cai Xinchen
2026-06-29 7:09 ` sashiko-bot
2026-06-30 22:23 ` [PATCH v3 stable/linux-6.12.y 0/3] Backport Fix incorrect overlayfs mmap() and mprotect() LSM access controls Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260629070130.0A5AF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=caixinchen1@huawei.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox