Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1493247

[PATCH cgroup/for-4.9] cpuset: fix error error handling regression in proc_cpuset_show()

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject [PATCH cgroup/for-4.9] cpuset: fix error error handling regression in proc_cpuset_show()
Date 2016-09-29 12:00 +0200
Message-ID <smGid-2kN-7@gated-at.bofh.it> (permalink)
References <smGid-2kN-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4c737b41de7f ("cgroup: make cgroup_path() and friends behave in the
style of strlcpy()") botched the conversion of proc_cpuset_show() and
broke its error handling.  It made the function return 0 on failures
and fail to handle error returns from cgroup_path_ns().  Fix it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Hello, Dan.

Does this make the warning go away?

Thanks.

 kernel/cpuset.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 793ae6f..97dd8e1 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2698,12 +2698,13 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
 	if (!buf)
 		goto out;
 
-	retval = -ENAMETOOLONG;
 	css = task_get_css(tsk, cpuset_cgrp_id);
 	retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX,
 				current->nsproxy->cgroup_ns);
 	css_put(css);
 	if (retval >= PATH_MAX)
+		retval = -ENAMETOOLONG;
+	if (retval < 0)
 		goto out_free;
 	seq_puts(m, buf);
 	seq_putc(m, '\n');
@@ -2711,7 +2712,7 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
 out_free:
 	kfree(buf);
 out:
-	return 0;
+	return retval;
 }
 #endif /* CONFIG_PROC_PID_CPUSET */
 

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH cgroup/for-4.9] cpuset: fix error error handling regression  in proc_cpuset_show() Tejun Heo <tj@kernel.org> - 2016-09-29 12:00 +0200
  Re: [PATCH cgroup/for-4.9] cpuset: fix error error handling  regression in proc_cpuset_show() Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-29 15:30 +0200
    [PATCH cgroup/for-4.6] cgroup: fix error handling regressions in  proc_cgroup_show() and cgroup_release_agent() Tejun Heo <tj@kernel.org> - 2016-09-29 16:00 +0200

csiph-web