Re: [PATCH] vfs: move_mount: reject moving kernel internal mounts

From: Eric Biggers
Date: Mon Jul 01 2019 - 11:43:22 EST


On Mon, Jul 01, 2019 at 02:08:48AM +0100, Al Viro wrote:
>
> Let's reorder that a bit:
> /* The mountpoint must be in our namespace. */
> if (!check_mnt(p))
> goto out;
>
> /* The thing moved must be mounted... */
> if (!is_mounted(old_path->mnt))
> goto out;
>
> /* ... and either ours or the root of anon namespace */
> if (!(attached ? check_mnt(old) : is_anon_ns(ns)))
> goto out;
>
> IMO that looks saner and all it costs us is a redundant check
> in attached case. Objections?

Looks good to me.

- Eric