From: Al Viro <viro@zeniv.linux.org.uk>
To: WangYuli <wangyuli@uniontech.com>
Cc: brauner@kernel.org, jack@suse.cz, akpm@linux-foundation.org,
tglx@linutronix.de, jlayton@kernel.org, frederic@kernel.org,
chenlinxuan@uniontech.com, xu.xin16@zte.com.cn,
adrian.ratiu@collabora.com, lorenzo.stoakes@oracle.com,
mingo@kernel.org, felix.moessbauer@siemens.com,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
zhanjun@uniontech.com, niecheng1@uniontech.com,
guanwentao@uniontech.com
Subject: Re: [PATCH] proc: Show the mountid associated with exe
Date: Sun, 11 May 2025 15:22:37 +0100 [thread overview]
Message-ID: <20250511142237.GA2023217@ZenIV> (raw)
In-Reply-To: <3885DACAB5D311F7+20250511114243.215132-1-wangyuli@uniontech.com>
On Sun, May 11, 2025 at 07:42:43PM +0800, WangYuli wrote:
> +static int proc_exe_mntid(struct seq_file *m, struct pid_namespace *ns,
> + struct pid *pid, struct task_struct *task)
> +{
> + struct file *exe_file;
> + struct path exe_path;
> +
> + exe_file = get_task_exe_file(task);
> +
> + if (exe_file) {
> + exe_path = exe_file->f_path;
> + path_get(&exe_file->f_path);
> +
> + seq_printf(m, "%i\n", real_mount(exe_path.mnt)->mnt_id);
> +
> + path_put(&exe_file->f_path);
Excuse me, just what is that path_get/path_put for? If you have
an opened file, you do have its ->f_path pinned and unchanging.
Otherwise this call of path_get() would've itself been unsafe...
And I still wonder about the rationale, TBH...
next prev parent reply other threads:[~2025-05-11 14:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-11 11:42 [PATCH] proc: Show the mountid associated with exe WangYuli
2025-05-11 14:22 ` Al Viro [this message]
2025-05-11 16:19 ` Chen Linxuan
2025-05-11 17:41 ` Al Viro
2025-05-12 9:11 ` Christian Brauner
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=20250511142237.GA2023217@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=adrian.ratiu@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=chenlinxuan@uniontech.com \
--cc=felix.moessbauer@siemens.com \
--cc=frederic@kernel.org \
--cc=guanwentao@uniontech.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mingo@kernel.org \
--cc=niecheng1@uniontech.com \
--cc=tglx@linutronix.de \
--cc=wangyuli@uniontech.com \
--cc=xu.xin16@zte.com.cn \
--cc=zhanjun@uniontech.com \
/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