projects
/
linux-2.6-block.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fork: report pid reservation failure properly
[linux-2.6-block.git]
/
kernel
/
pid.c
diff --git
a/kernel/pid.c
b/kernel/pid.c
index cd36a5e0d173062dfbdd557fa7ad5234350af2ed..4fd07d5b7baf3b0176388b8ce0f06511b56ba2cc 100644
(file)
--- a/
kernel/pid.c
+++ b/
kernel/pid.c
@@
-182,7
+182,7
@@
static int alloc_pidmap(struct pid_namespace *pid_ns)
spin_unlock_irq(&pidmap_lock);
kfree(page);
if (unlikely(!map->page))
spin_unlock_irq(&pidmap_lock);
kfree(page);
if (unlikely(!map->page))
-
break
;
+
return -ENOMEM
;
}
if (likely(atomic_read(&map->nr_free))) {
for ( ; ; ) {
}
if (likely(atomic_read(&map->nr_free))) {
for ( ; ; ) {
@@
-210,7
+210,7
@@
static int alloc_pidmap(struct pid_namespace *pid_ns)
}
pid = mk_pid(pid_ns, map, offset);
}
}
pid = mk_pid(pid_ns, map, offset);
}
- return -
1
;
+ return -
EAGAIN
;
}
int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
}
int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
@@
-301,17
+301,20
@@
struct pid *alloc_pid(struct pid_namespace *ns)
int i, nr;
struct pid_namespace *tmp;
struct upid *upid;
int i, nr;
struct pid_namespace *tmp;
struct upid *upid;
+ int retval = -ENOMEM;
pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
if (!pid)
pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
if (!pid)
-
goto out
;
+
return ERR_PTR(retval)
;
tmp = ns;
pid->level = ns->level;
for (i = ns->level; i >= 0; i--) {
nr = alloc_pidmap(tmp);
tmp = ns;
pid->level = ns->level;
for (i = ns->level; i >= 0; i--) {
nr = alloc_pidmap(tmp);
- if (nr < 0)
+ if (IS_ERR_VALUE(nr)) {
+ retval = nr;
goto out_free;
goto out_free;
+ }
pid->numbers[i].nr = nr;
pid->numbers[i].ns = tmp;
pid->numbers[i].nr = nr;
pid->numbers[i].ns = tmp;
@@
-339,7
+342,6
@@
struct pid *alloc_pid(struct pid_namespace *ns)
}
spin_unlock_irq(&pidmap_lock);
}
spin_unlock_irq(&pidmap_lock);
-out:
return pid;
out_unlock:
return pid;
out_unlock:
@@
-351,8
+353,7
@@
out_free:
free_pidmap(pid->numbers + i);
kmem_cache_free(ns->pid_cachep, pid);
free_pidmap(pid->numbers + i);
kmem_cache_free(ns->pid_cachep, pid);
- pid = NULL;
- goto out;
+ return ERR_PTR(retval);
}
void disable_pid_allocation(struct pid_namespace *ns)
}
void disable_pid_allocation(struct pid_namespace *ns)