]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
x86/intel_rdt: Put group node in rdtgroup_kn_unlock
authorJiri Olsa <jolsa@kernel.org>
Tue, 14 Mar 2017 14:20:53 +0000 (15:20 +0100)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 22 Mar 2017 14:02:34 +0000 (08:02 -0600)
commite5c57ccd44c517b78fac86c053811ba79d8750ed
treed4f54769218095de3462af22ac578ba0ca26f8a8
parent2b1c19de492ff92532132fd3b96dc6cdb05e08a8
x86/intel_rdt: Put group node in rdtgroup_kn_unlock

BugLink: http://bugs.launchpad.net/bugs/1675032
commit 49ec8f5b6ae3ab60385492cad900ffc8a523c895 upstream.

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>
Link: http://lkml.kernel.org/r/1489501253-20248-1-git-send-email-jolsa@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c