@@ -39,26 +39,6 @@ static inline bool initial_idmapping(const struct user_namespace *ns)
3939 return ns == & init_user_ns ;
4040}
4141
42- /**
43- * no_idmapping - check whether we can skip remapping a kuid/gid
44- * @mnt_userns: the mount's idmapping
45- * @fs_userns: the filesystem's idmapping
46- *
47- * This function can be used to check whether a remapping between two
48- * idmappings is required.
49- * An idmapped mount is a mount that has an idmapping attached to it that
50- * is different from the filsystem's idmapping and the initial idmapping.
51- * If the initial mapping is used or the idmapping of the mount and the
52- * filesystem are identical no remapping is required.
53- *
54- * Return: true if remapping can be skipped, false if not.
55- */
56- static inline bool no_idmapping (const struct user_namespace * mnt_userns ,
57- const struct user_namespace * fs_userns )
58- {
59- return initial_idmapping (mnt_userns ) || mnt_userns == fs_userns ;
60- }
61-
6242/**
6343 * make_vfsuid - map a filesystem kuid according to an idmapping
6444 * @idmap: the mount's idmapping
@@ -68,8 +48,8 @@ static inline bool no_idmapping(const struct user_namespace *mnt_userns,
6848 * Take a @kuid and remap it from @fs_userns into @idmap. Use this
6949 * function when preparing a @kuid to be reported to userspace.
7050 *
71- * If no_idmapping () determines that this is not an idmapped mount we can
72- * simply return @kuid unchanged.
51+ * If initial_idmapping () determines that this is not an idmapped mount
52+ * we can simply return @kuid unchanged.
7353 * If initial_idmapping() tells us that the filesystem is not mounted with an
7454 * idmapping we know the value of @kuid won't change when calling
7555 * from_kuid() so we can simply retrieve the value via __kuid_val()
@@ -87,7 +67,7 @@ vfsuid_t make_vfsuid(struct mnt_idmap *idmap,
8767 uid_t uid ;
8868 struct user_namespace * mnt_userns = idmap -> owner ;
8969
90- if (no_idmapping ( mnt_userns , fs_userns ) )
70+ if (idmap == & nop_mnt_idmap )
9171 return VFSUIDT_INIT (kuid );
9272 if (initial_idmapping (fs_userns ))
9373 uid = __kuid_val (kuid );
@@ -108,8 +88,8 @@ EXPORT_SYMBOL_GPL(make_vfsuid);
10888 * Take a @kgid and remap it from @fs_userns into @idmap. Use this
10989 * function when preparing a @kgid to be reported to userspace.
11090 *
111- * If no_idmapping () determines that this is not an idmapped mount we can
112- * simply return @kgid unchanged.
91+ * If initial_idmapping () determines that this is not an idmapped mount
92+ * we can simply return @kgid unchanged.
11393 * If initial_idmapping() tells us that the filesystem is not mounted with an
11494 * idmapping we know the value of @kgid won't change when calling
11595 * from_kgid() so we can simply retrieve the value via __kgid_val()
@@ -125,7 +105,7 @@ vfsgid_t make_vfsgid(struct mnt_idmap *idmap,
125105 gid_t gid ;
126106 struct user_namespace * mnt_userns = idmap -> owner ;
127107
128- if (no_idmapping ( mnt_userns , fs_userns ) )
108+ if (idmap == & nop_mnt_idmap )
129109 return VFSGIDT_INIT (kgid );
130110 if (initial_idmapping (fs_userns ))
131111 gid = __kgid_val (kgid );
@@ -154,7 +134,7 @@ kuid_t from_vfsuid(struct mnt_idmap *idmap,
154134 uid_t uid ;
155135 struct user_namespace * mnt_userns = idmap -> owner ;
156136
157- if (no_idmapping ( mnt_userns , fs_userns ) )
137+ if (idmap == & nop_mnt_idmap )
158138 return AS_KUIDT (vfsuid );
159139 uid = from_kuid (mnt_userns , AS_KUIDT (vfsuid ));
160140 if (uid == (uid_t )- 1 )
@@ -182,7 +162,7 @@ kgid_t from_vfsgid(struct mnt_idmap *idmap,
182162 gid_t gid ;
183163 struct user_namespace * mnt_userns = idmap -> owner ;
184164
185- if (no_idmapping ( mnt_userns , fs_userns ) )
165+ if (idmap == & nop_mnt_idmap )
186166 return AS_KGIDT (vfsgid );
187167 gid = from_kgid (mnt_userns , AS_KGIDT (vfsgid ));
188168 if (gid == (gid_t )- 1 )
0 commit comments