Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1600483 > unrolled thread
| Started by | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| First post | 2017-03-14 15:30 +0100 |
| Last post | 2017-03-14 22:00 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] x86/intel_rdt: Put group node in rdtgroup_kn_unlock Jiri Olsa <jolsa@kernel.org> - 2017-03-14 15:30 +0100
[tip:x86/urgent] x86/intel_rdt: Put group node in rdtgroup_kn_unlock tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-03-14 22:00 +0100
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Date | 2017-03-14 15:30 +0100 |
| Subject | [PATCH] x86/intel_rdt: Put group node in rdtgroup_kn_unlock |
| Message-ID | <tkVCy-1ny-17@gated-at.bofh.it> |
The rdtgroup_kn_unlock waits for the last user to release
and put its node. But it's calling kernfs_put on the node
which calls the rdtgroup_kn_unlock, which might not be
the group's directory node, but another group's file node.
This race could be easily reproduced by running 2 instances
of following script:
mount -t resctrl resctrl /sys/fs/resctrl/
pushd /sys/fs/resctrl/
mkdir krava
echo "krava" > krava/schemata
rmdir krava
popd
umount /sys/fs/resctrl
It triggers the slub debug error message with following command
line config: slub_debug=,kernfs_node_cache.
Calling kernfs_put on the group's node.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index c05509d38b1f..9ac2a5cdd9c2 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -727,7 +727,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn)
if (atomic_dec_and_test(&rdtgrp->waitcount) &&
(rdtgrp->flags & RDT_DELETED)) {
kernfs_unbreak_active_protection(kn);
- kernfs_put(kn);
+ kernfs_put(rdtgrp->kn);
kfree(rdtgrp);
} else {
kernfs_unbreak_active_protection(kn);
--
2.9.3
[toc] | [next] | [standalone]
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Date | 2017-03-14 22:00 +0100 |
| Subject | [tip:x86/urgent] x86/intel_rdt: Put group node in rdtgroup_kn_unlock |
| Message-ID | <tl1HY-5G2-25@gated-at.bofh.it> |
| In reply to | #1600483 |
Commit-ID: 49ec8f5b6ae3ab60385492cad900ffc8a523c895
Gitweb: http://git.kernel.org/tip/49ec8f5b6ae3ab60385492cad900ffc8a523c895
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 14 Mar 2017 15:20:53 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 14 Mar 2017 21:51:58 +0100
x86/intel_rdt: Put group node in rdtgroup_kn_unlock
The rdtgroup_kn_unlock waits for the last user to release and put its
node. But it's calling kernfs_put on the node which calls the
rdtgroup_kn_unlock, which might not be the group's directory node, but
another group's file node.
This race could be easily reproduced by running 2 instances
of following script:
mount -t resctrl resctrl /sys/fs/resctrl/
pushd /sys/fs/resctrl/
mkdir krava
echo "krava" > krava/schemata
rmdir krava
popd
umount /sys/fs/resctrl
It triggers the slub debug error message with following command
line config: slub_debug=,kernfs_node_cache.
Call kernfs_put on the group's node to fix it.
Fixes: 60cf5e101fd4 ("x86/intel_rdt: Add mkdir to resctrl file system")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Shaohua Li <shli@fb.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1489501253-20248-1-git-send-email-jolsa@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index c05509d..9ac2a5c 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -727,7 +727,7 @@ void rdtgroup_kn_unlock(struct kernfs_node *kn)
if (atomic_dec_and_test(&rdtgrp->waitcount) &&
(rdtgrp->flags & RDT_DELETED)) {
kernfs_unbreak_active_protection(kn);
- kernfs_put(kn);
+ kernfs_put(rdtgrp->kn);
kfree(rdtgrp);
} else {
kernfs_unbreak_active_protection(kn);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web