提交 1cc3e33b 编写于 作者: liulangrenaaa's avatar liulangrenaaa 提交者: Zheng Zengkai

cgroup/cgroup.c: replace 'of->kn->priv' with of_cft()

mainline inclusion
from mainline-v5.11-rc2
commit 5a7b5f32
bugzilla: 186050 https://gitee.com/openeuler/kernel/issues/I4DDEL
CVE: CVE-2021-4197

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5a7b5f32c5aa628841502d19a813c633ff6ecbe4

--------------------------------

we have supplied the inline function: of_cft() in cgroup.h.

So replace the direct use 'of->kn->priv' with inline func
of_cft(), which is more readable.
Signed-off-by: liulangrenaaa's avatarHui Su <sh_def@163.com>
Signed-off-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NLu Jialin <lujialin4@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7d43c940
......@@ -3763,7 +3763,7 @@ static ssize_t cgroup_freeze_write(struct kernfs_open_file *of,
static int cgroup_file_open(struct kernfs_open_file *of)
{
struct cftype *cft = of->kn->priv;
struct cftype *cft = of_cft(of);
if (cft->open)
return cft->open(of);
......@@ -3772,7 +3772,7 @@ static int cgroup_file_open(struct kernfs_open_file *of)
static void cgroup_file_release(struct kernfs_open_file *of)
{
struct cftype *cft = of->kn->priv;
struct cftype *cft = of_cft(of);
if (cft->release)
cft->release(of);
......@@ -3783,7 +3783,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
{
struct cgroup_namespace *ns = current->nsproxy->cgroup_ns;
struct cgroup *cgrp = of->kn->parent->priv;
struct cftype *cft = of->kn->priv;
struct cftype *cft = of_cft(of);
struct cgroup_subsys_state *css;
int ret;
......@@ -3833,7 +3833,7 @@ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf,
static __poll_t cgroup_file_poll(struct kernfs_open_file *of, poll_table *pt)
{
struct cftype *cft = of->kn->priv;
struct cftype *cft = of_cft(of);
if (cft->poll)
return cft->poll(of, pt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册