Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5e7b3c5 authored by Eric W. Biederman's avatar Eric W. Biederman
Browse files

userns: Don't read extents twice in m_start



This is important so reading /proc/<pid>/{uid_map,gid_map,projid_map} while
the map is being written does not do strange things.

Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
parent 3edf652f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -683,11 +683,13 @@ static void *m_start(struct seq_file *seq, loff_t *ppos,
		     struct uid_gid_map *map)
{
	loff_t pos = *ppos;
	unsigned extents = map->nr_extents;
	smp_rmb();

	if (pos >= map->nr_extents)
	if (pos >= extents)
		return NULL;

	if (map->nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS)
	if (extents <= UID_GID_MAP_MAX_BASE_EXTENTS)
		return &map->extent[pos];

	return &map->forward[pos];