Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 94457b36e8a5 ("x86/intel_rdt: Add diagnostics when writing the cpus file")
Fixes: cfd0f34e4cd5 ("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

authored by

Xiaochen Shen and committed by
Borislav Petkov
c8eafe14 fc5db585

-4
-4
arch/x86/kernel/cpu/resctrl/rdtgroup.c
··· 461 461 } 462 462 463 463 rdtgrp = rdtgroup_kn_lock_live(of->kn); 464 - rdt_last_cmd_clear(); 465 464 if (!rdtgrp) { 466 465 ret = -ENOENT; 467 - rdt_last_cmd_puts("Directory was removed\n"); 468 466 goto unlock; 469 467 } 470 468 ··· 2646 2648 int ret; 2647 2649 2648 2650 prdtgrp = rdtgroup_kn_lock_live(prgrp_kn); 2649 - rdt_last_cmd_clear(); 2650 2651 if (!prdtgrp) { 2651 2652 ret = -ENODEV; 2652 - rdt_last_cmd_puts("Directory was removed\n"); 2653 2653 goto out_unlock; 2654 2654 } 2655 2655