From: Tejun Heo <tj@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>, Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH cgroup/for-4.9] cpuset: fix error error handling regression in proc_cpuset_show()
Date: Thu, 29 Sep 2016 11:58:36 +0200 [thread overview]
Message-ID: <20160929095836.GB24034@mtj.duckdns.org> (raw)
In-Reply-To: <20160929092722.GA5513@mwanda>
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 */
next parent reply other threads:[~2016-09-29 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160929092722.GA5513@mwanda>
2016-09-29 9:58 ` Tejun Heo [this message]
2016-09-29 13:27 ` Dan Carpenter
2016-09-29 13:54 ` [PATCH cgroup/for-4.6] cgroup: fix error handling regressions in proc_cgroup_show() and cgroup_release_agent() Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160929095836.GB24034@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®