Re: Re: [PATCH] statmount: Fix the null-ptr-deref in do_statmount()
From: Qing Wang
Date: Fri Feb 13 2026 - 05:35:15 EST
On Fri, 13 Feb 2026 at 17:38, "Bhavik Sachdev" <b.sachdev1904@xxxxxxxxx> wrote:
> Hey!
> I think the fix should be the following instead, AFAIU we don't want a
> call to an internal mount to succeed.
>
> diff --git a/fs/namespace.c b/fs/namespace.c
> index a67cbe42746d..55152bf64785 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -5678,6 +5678,8 @@ static int do_statmount(struct kstatmount *s, u64 mnt=
> _id, u64 mnt_ns_id,
>
> s->mnt =3D mnt_file->f_path.mnt;
> ns =3D real_mount(s->mnt)->mnt_ns;
> + if (IS_ERR(ns))
> + return -EINVAL;
> if (!ns)
> /*
> * We can't set mount point and mnt_ns_id since we =
> don't have a
>
> Thanks,
> Bhavik
I had considered returning an error code before but finally decided to
not. Thank you for your suggestion, I agree with it and resend the patch
v3 [0].
[0] https://lore.kernel.org/all/20260213103006.2472569-1-wangqing7171@xxxxxxxxx/T/
Look forward to your review.
---
Thanks,
Qing