]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
namespace: fix proc mount iteration
authorChristian Brauner <brauner@kernel.org>
Thu, 29 Jan 2026 13:52:22 +0000 (14:52 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 18 Feb 2026 13:04:42 +0000 (14:04 +0100)
commit4a403d7aa9074f527f064ef0806aaab38d14b07c
tree289a65ccde308209771018468a3bd111a6c135bd
parenta41dbf5e004edbe1260883c43a8bd134d9cb0c1c
namespace: fix proc mount iteration

The m->index isn't updated when m->show() overflows and retains its
value before the current mount causing a restart to start at the same
value. If that happens in short order to due a quickly expanding mount
table this would cause the same mount to be shown again and again.

Ensure that *pos always equals the mount id of the mount that was
returned by start/next. On restart after overflow mnt_find_id_at(*pos)
finds the exact mount. This should avoid duplicates, avoid skips and
should handle concurrent modification just fine.

Cc: <stable@vger.kernel.org>
Fixed: 2eea9ce4310d8 ("mounts: keep list of mounts in an rbtree")
Link: https://patch.msgid.link/20260129-geleckt-treuhand-4bb940acacd9@brauner
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namespace.c