diff options
| -rw-r--r-- | kernel/pid_namespace.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index eb00be205811..7b07cc0dfb75 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
| @@ -71,12 +71,22 @@ err_alloc: | |||
| 71 | return NULL; | 71 | return NULL; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /* MAX_PID_NS_LEVEL is needed for limiting size of 'struct pid' */ | ||
| 75 | #define MAX_PID_NS_LEVEL 32 | ||
| 76 | |||
| 74 | static struct pid_namespace *create_pid_namespace(struct pid_namespace *parent_pid_ns) | 77 | static struct pid_namespace *create_pid_namespace(struct pid_namespace *parent_pid_ns) |
| 75 | { | 78 | { |
| 76 | struct pid_namespace *ns; | 79 | struct pid_namespace *ns; |
| 77 | unsigned int level = parent_pid_ns->level + 1; | 80 | unsigned int level = parent_pid_ns->level + 1; |
| 78 | int i, err = -ENOMEM; | 81 | int i; |
| 82 | int err; | ||
| 83 | |||
| 84 | if (level > MAX_PID_NS_LEVEL) { | ||
| 85 | err = -EINVAL; | ||
| 86 | goto out; | ||
| 87 | } | ||
| 79 | 88 | ||
| 89 | err = -ENOMEM; | ||
| 80 | ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); | 90 | ns = kmem_cache_zalloc(pid_ns_cachep, GFP_KERNEL); |
| 81 | if (ns == NULL) | 91 | if (ns == NULL) |
| 82 | goto out; | 92 | goto out; |
