diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-11-12 15:11:23 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 12:09:34 +0900 |
commit | 0d20633b041041ecda39ae562e62087acf0092f1 (patch) | |
tree | fdc3283c0a96c22705c103b04a87567029a9c4a8 | |
parent | 3fa582663129330d57d15b97ae534dc1203fc3aa (diff) | |
download | kernel_replicant_linux-0d20633b041041ecda39ae562e62087acf0092f1.tar.gz kernel_replicant_linux-0d20633b041041ecda39ae562e62087acf0092f1.tar.bz2 kernel_replicant_linux-0d20633b041041ecda39ae562e62087acf0092f1.zip |
kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener()
For registering in add_del_listener(), when kmalloc_node() fails, need
return -ENOMEM instead of success code, and cmd_attr_register_cpumask()
wants to know about it.
After modification, give a simple common test "build -> boot up ->
kernel/controllers/cgroup/getdelays by LTP tools".
Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/taskstats.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 1db6808c494b..9f4618eb51c8 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -290,6 +290,7 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd) struct listener_list *listeners; struct listener *s, *tmp, *s2; unsigned int cpu; + int ret = 0; if (!cpumask_subset(mask, cpu_possible_mask)) return -EINVAL; @@ -304,9 +305,10 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd) for_each_cpu(cpu, mask) { s = kmalloc_node(sizeof(struct listener), GFP_KERNEL, cpu_to_node(cpu)); - if (!s) + if (!s) { + ret = -ENOMEM; goto cleanup; - + } s->pid = pid; s->valid = 1; @@ -339,7 +341,7 @@ cleanup: } up_write(&listeners->sem); } - return 0; + return ret; } static int parse(struct nlattr *na, struct cpumask *mask) |