]> git.baikalelectronics.ru Git - kernel.git/commit
x86/resctrl: Fix potential lockdep warning
authorXiaochen Shen <xiaochen.shen@intel.com>
Wed, 6 Nov 2019 22:36:36 +0000 (06:36 +0800)
committerBorislav Petkov <bp@suse.de>
Wed, 13 Nov 2019 11:34:44 +0000 (12:34 +0100)
commit657282965979a2bb04af33ed4f5ef051065c301c
treeed43632d17ddd199b8b67ce5b10bf8dcd9c80f49
parentaccb16b0457c595f0e9980cbdac75d36a1344984
x86/resctrl: Fix potential lockdep warning

rdtgroup_cpus_write() and mkdir_rdt_prepare() call
rdtgroup_kn_lock_live() -> kernfs_to_rdtgroup() to get 'rdtgrp', and
then call the rdt_last_cmd_{clear,puts,...}() functions which will check
if rdtgroup_mutex is held/requires its caller to hold rdtgroup_mutex.

But if 'rdtgrp' returned from kernfs_to_rdtgroup() is NULL,
rdtgroup_mutex is not held and calling rdt_last_cmd_{clear,puts,...}()
will result in a self-incurred, potential lockdep warning.

Remove the rdt_last_cmd_{clear,puts,...}() calls in these two paths.
Just returning error should be sufficient to report to the user that the
entry doesn't exist any more.

 [ bp: Massage. ]

Fixes: 6ce95eb44579 ("x86/intel_rdt: Add diagnostics when writing the cpus file")
Fixes: c304a8cb6cb3 ("x86/intel_rdt: Add diagnostics when making directories")
Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: pei.p.jia@intel.com
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/1573079796-11713-1-git-send-email-xiaochen.shen@intel.com
arch/x86/kernel/cpu/resctrl/rdtgroup.c