From: yangerkun <yangerkun@huawei.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>, <viro@zeniv.linux.org.uk>,
<brauner@kernel.org>, <jlayton@kernel.org>,
<josef@toxicpanda.com>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<yi.zhang@huawei.com>, <changdiankang@huawei.com>
Subject: Re: [PATCH v2] nsfs: fix wrong error code returned for pidns ioctls
Date: Thu, 7 May 2026 19:29:14 +0800 [thread overview]
Message-ID: <dc3a864f-a325-49b2-9827-c957f48211f1@huawei.com> (raw)
In-Reply-To: <20260507112301.1042757-1-chengzhihao1@huawei.com>
LGTM
Reviewed-by: Yang Erkun <yangerkun@huawei.com>
在 2026/5/7 19:23, Zhihao Cheng 写道:
> When executing NS_GET_PID_FROM_PIDNS (or similar pidns ioctls), if the
> target task cannot be found in the corresponding pid_ns, the error code
> should be ESRCH instead of ENOTTY.
>
> This bug was introduced when the extensible ioctl handling was added.
> Without proper return, ret would be overwritten by the default case in
> the extensible ioctl switch statement.
>
> Fixes: a1d220d9dafa8 ("nsfs: iterate through mount namespaces")
> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
> ---
> v1->v2: Delete unnecessary blank line.
> fs/nsfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nsfs.c b/fs/nsfs.c
> index 51e8c9430477..160018c4fb36 100644
> --- a/fs/nsfs.c
> +++ b/fs/nsfs.c
> @@ -266,7 +266,7 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
> else
> tsk = find_task_by_pid_ns(arg, pid_ns);
> if (!tsk)
> - break;
> + return ret;
>
> switch (ioctl) {
> case NS_GET_PID_FROM_PIDNS:
next prev parent reply other threads:[~2026-05-07 11:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 11:23 Zhihao Cheng
2026-05-07 11:29 ` yangerkun [this message]
2026-05-11 14:00 ` 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=dc3a864f-a325-49b2-9827-c957f48211f1@huawei.com \
--to=yangerkun@huawei.com \
--cc=brauner@kernel.org \
--cc=changdiankang@huawei.com \
--cc=chengzhihao1@huawei.com \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yi.zhang@huawei.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
all inboxes | Powered by JetHome®