diff options
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r-- | kernel/user_namespace.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index e5222b5fb4fe..923414a246e9 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -974,10 +974,6 @@ static ssize_t map_write(struct file *file, const char __user *buf, | |||
974 | if (!new_idmap_permitted(file, ns, cap_setid, &new_map)) | 974 | if (!new_idmap_permitted(file, ns, cap_setid, &new_map)) |
975 | goto out; | 975 | goto out; |
976 | 976 | ||
977 | ret = sort_idmaps(&new_map); | ||
978 | if (ret < 0) | ||
979 | goto out; | ||
980 | |||
981 | ret = -EPERM; | 977 | ret = -EPERM; |
982 | /* Map the lower ids from the parent user namespace to the | 978 | /* Map the lower ids from the parent user namespace to the |
983 | * kernel global id space. | 979 | * kernel global id space. |
@@ -1004,6 +1000,14 @@ static ssize_t map_write(struct file *file, const char __user *buf, | |||
1004 | e->lower_first = lower_first; | 1000 | e->lower_first = lower_first; |
1005 | } | 1001 | } |
1006 | 1002 | ||
1003 | /* | ||
1004 | * If we want to use binary search for lookup, this clones the extent | ||
1005 | * array and sorts both copies. | ||
1006 | */ | ||
1007 | ret = sort_idmaps(&new_map); | ||
1008 | if (ret < 0) | ||
1009 | goto out; | ||
1010 | |||
1007 | /* Install the map */ | 1011 | /* Install the map */ |
1008 | if (new_map.nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) { | 1012 | if (new_map.nr_extents <= UID_GID_MAP_MAX_BASE_EXTENTS) { |
1009 | memcpy(map->extent, new_map.extent, | 1013 | memcpy(map->extent, new_map.extent, |