Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d20633b authored by Chen Gang's avatar Chen Gang Committed by Linus Torvalds
Browse files

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: default avatarChen Gang <gang.chen@asianux.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3fa58266
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
		}
		up_write(&listeners->sem);
	}
	return 0;
	return ret;
}

static int parse(struct nlattr *na, struct cpumask *mask)