]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
vfs/idmapped_mounts.c: Incorrect array index for nested user ns
authorTaylor Jackson <tjackson9431@gmail.com>
Tue, 26 Mar 2024 20:33:51 +0000 (20:33 +0000)
committerZorro Lang <zlang@kernel.org>
Wed, 27 Mar 2024 14:05:18 +0000 (22:05 +0800)
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>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
src/vfs/idmapped-mounts.c

index 547182fe1971c265b03b43399701b715cd62fb7a..34052ca387c667aeee2165bf19015b0194e5d43f 100644 (file)
@@ -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);