From: Xie XiuQi <xiexiuqi(a)huawei.com>
commit 14405c9eb792d93374e569511d9961f62a4d8a53 openEuler-1.0
hulk inclusion
category: bugfix
bugzilla: 14212
CVE: NA
In error path, we should put the resource and unlock of->kn.
Signed-off-by: Xie XiuQi <xiexiuqi(a)huawei.com>
Reviewed-by: Hanjun Guo <guohanjun(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
arch/arm64/kernel/mpam_ctrlmon.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/mpam_ctrlmon.c b/arch/arm64/kernel/mpam_ctrlmon.c
index ae6afc90a256..02623c1c23e8 100644
--- a/arch/arm64/kernel/mpam_ctrlmon.c
+++ b/arch/arm64/kernel/mpam_ctrlmon.c
@@ -354,8 +354,8 @@ int resctrl_group_mondata_show(struct seq_file *m, void *arg)
rdtgrp = resctrl_group_kn_lock_live(of->kn);
if (!rdtgrp) {
- resctrl_group_kn_unlock(of->kn);
- return -ENOENT;
+ ret = -ENOENT;
+ goto out;
}
md.priv = of->kn->priv;
@@ -365,14 +365,16 @@ int resctrl_group_mondata_show(struct seq_file *m, void *arg)
/* show monitor data */
d = mpam_find_domain(r, md.u.domid, NULL);
- if (IS_ERR(d)) {
+ if (IS_ERR_OR_NULL(d)) {
pr_warn("Could't find domain id %d\n", md.u.domid);
- return -ENOENT;
+ ret = -ENOENT;
+ goto out;
}
usage = rr->mon_read(d, rdtgrp);
seq_printf(m, "%llu\n", usage);
+out:
put_resource_name(resname);
resctrl_group_kn_unlock(of->kn);
return ret;
--
2.31.0