Skip to contentSkip to conversation

ns: Fix mnt ns ida handling in copy_mnt_ns()

PATCH Applied Jan Kara 2 participants 5 messages Oct 2, 2025 – Oct 7, 2025 VFS

lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 ns: Fix mnt ns ida handling in copy_mnt_ns()

Commit be5f21d3985f ("ns: add ns_common_free()") modified error cleanup and started to free wrong inode number from the ida. Fix it.

Reported-by [email protected]
Reported-by [email protected]
Fixes be5f21d3985f ("ns: add ns_common_free()")
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
index dc01b14c58cd..1ba97d745019 100644
@@ -4165,7 +4165,7 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
 	new = copy_tree(old, old->mnt.mnt_root, copy_flags);
 	if (IS_ERR(new)) {
 		namespace_unlock();
-		ns_common_free(ns);
+		ns_common_free(new_ns);
 		dec_mnt_namespaces(new_ns->ucounts);
 		mnt_ns_release(new_ns);
 		return ERR_CAST(new);
Signature · 1 line
2.51.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Jan Kara

Commit be5f21d3985f ("ns: add ns_common_free()") modified error cleanup and started to free wrong inode number from the ida. Fix it.

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] ns: Fix mnt ns ida handling in copy_mnt_ns()

      https://git.kernel.org/vfs/vfs/c/502f6e0e7b72
#2 lore raw
Quoted 15 lines · Christian Brauner
Quoted 4 lines · Jan Kara

Commit be5f21d3985f ("ns: add ns_common_free()") modified error cleanup and started to free wrong inode number from the ida. Fix it.

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Quoted 8 lines

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] ns: Fix mnt ns ida handling in copy_mnt_ns()

      https://git.kernel.org/vfs/vfs/c/502f6e0e7b72

Jan, I think Al fixed this in his series on accident in upstream. So I think we can drop your patch. emptied_ns is cleaned up after namespace_unlock() and will call free_mnt_ns() which will call ns_common_free(). Please take a look at what's in mainline and let me know if you read it the same way!

author reviewer
#3 lore raw
Quoted 22 lines · Christian Brauner
Quoted 21 lines · Christian Brauner
Quoted 4 lines · Jan Kara

Commit be5f21d3985f ("ns: add ns_common_free()") modified error cleanup and started to free wrong inode number from the ida. Fix it.

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
Quoted 8 lines
Quoted 2 lines

[1/1] ns: Fix mnt ns ida handling in copy_mnt_ns()

      https://git.kernel.org/vfs/vfs/c/502f6e0e7b72

Jan, I think Al fixed this in his series on accident in upstream. So I think we can drop your patch. emptied_ns is cleaned up after namespace_unlock() and will call free_mnt_ns() which will call ns_common_free(). Please take a look at what's in mainline and let me know if you read it the same way!

I've checked it and indeed Al's changes silently fixed this. So all should be fine.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR