diff mbox series

[1/2] vfs/idmapped_mounts.c: Incorrect array index for nested user ns

Message ID 20240326-mount-setattr-test-v1-1-c061b040d0f7@gmail.com (mailing list archive)
State New, archived
Headers show
Series Patches to update xfs test "generic/645" for mount_setattr | expand

Commit Message

Taylor Jackson via B4 Relay March 26, 2024, 8:33 p.m. UTC
From: Taylor Jackson <tjackson9431@gmail.com>

Within the vfs test for idmapped mounts, the function nested_userns()
is using an incorrect array index when attempting to set up the mapping
for the 4th nested user ns within hierarchy[4]. The correct index that
belongs to the 4th nested user ns is actually hierarchy[3].
And hierarchy[4] is reserved for the dummy entry that marks the end
of the array.

Signed-off-by: Taylor Jackson <tjackson9431@gmail.com>
---
 src/vfs/idmapped-mounts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Brauner March 27, 2024, 10:31 a.m. UTC | #1
On Tue, Mar 26, 2024 at 08:33:51PM +0000, Taylor Jackson via B4 Relay wrote:
> From: Taylor Jackson <tjackson9431@gmail.com>
> 
> Within the vfs test for idmapped mounts, the function nested_userns()
> is using an incorrect array index when attempting to set up the mapping
> for the 4th nested user ns within hierarchy[4]. The correct index that
> belongs to the 4th nested user ns is actually hierarchy[3].
> And hierarchy[4] is reserved for the dummy entry that marks the end
> of the array.
> 
> Signed-off-by: Taylor Jackson <tjackson9431@gmail.com>
> ---

Ah, thanks for fixing this!
Reviewed-by: Christian Brauner <brauner@kernel.org>
diff mbox series

Patch

diff --git a/src/vfs/idmapped-mounts.c b/src/vfs/idmapped-mounts.c
index 547182fe..34052ca3 100644
--- a/src/vfs/idmapped-mounts.c
+++ b/src/vfs/idmapped-mounts.c
@@ -6556,7 +6556,7 @@  static int nested_userns(const struct vfstest_info *info)
 	}
 
 	/* Don't write a mapping in the 4th userns. */
-	list_empty(&hierarchy[4].id_map);
+	list_empty(&hierarchy[3].id_map);
 
 	/* Create the actual userns hierarchy. */
 	ret = create_userns_hierarchy(hierarchy);