On Sat, 3 May 2025 22:29:25 +0100
Al Viro <[email protected]> wrote:

> @@ -10081,10 +10084,20 @@ static struct vfsmount *trace_automount(struct 
> dentry *mntpt, void *ingore)
>       type = get_fs_type("tracefs");
>       if (!type)
>               return NULL;
> -     mnt = vfs_submount(mntpt, type, "tracefs", NULL);
> +
> +     fc = fs_context_for_submount(type, mntpt);
> +     if (IS_ERR(fc))
> +             return ERR_CAST(fc);

As Jan mentioned, the put_filesystem(type) is need in the error path.

> +
> +     ret = vfs_parse_fs_string(fc, "source",
> +                               "tracefs", strlen("tracefs"));
> +     if (!ret)
> +             mnt = fc_mount(fc);
> +     else
> +             mnt = ERR_PTR(ret);
> +
> +     put_fs_context(fc);
>       put_filesystem(type);
> -     if (IS_ERR(mnt))
> -             return NULL;

This didn't apply cleanly to Linus's tree, nor linux-next, due to missing:

        mntget(mnt);

Was that supposed to be deleted too?

Anyway, I applied this (still keeping the mntget()) and it appears to work.

-- Steve


>       return mnt;
>  }

Reply via email to