Skip to content
Commit 579035dc authored by Andrew Vagin's avatar Andrew Vagin Committed by Linus Torvalds
Browse files

pid-namespace: limit value of ns_last_pid to (0, max_pid)



The kernel doesn't check the pid for negative values, so if you try to
write -2 to /proc/sys/kernel/ns_last_pid, you will get a kernel panic.

The crash happens because the next pid is -1, and alloc_pidmap() will
try to access to a nonexistent pidmap.

  map = &pid_ns->pidmap[pid/BITS_PER_PAGE];

Signed-off-by: default avatarAndrew Vagin <avagin@openvz.org>
Acked-by: default avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 35c448a8
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment