]> Git Repo - J-linux.git/commitdiff
x86/resctrl: Fix potential lockdep warning
authorXiaochen Shen <[email protected]>
Wed, 6 Nov 2019 22:36:36 +0000 (06:36 +0800)
committerBorislav Petkov <[email protected]>
Wed, 13 Nov 2019 11:34:44 +0000 (12:34 +0100)
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 <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Reviewed-by: Tony Luck <[email protected]>
Reviewed-by: Fenghua Yu <[email protected]>
Reviewed-by: Reinette Chatre <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: [email protected]
Cc: Thomas Gleixner <[email protected]>
Cc: x86-ml <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
arch/x86/kernel/cpu/resctrl/rdtgroup.c

index a46dee8e78db4a22dafd063a7cf38187f44dc457..2e3b06d6bbc6df9b311bd6e9b942ea0ea4b1fc67 100644 (file)
@@ -461,10 +461,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
        }
 
        rdtgrp = rdtgroup_kn_lock_live(of->kn);
-       rdt_last_cmd_clear();
        if (!rdtgrp) {
                ret = -ENOENT;
-               rdt_last_cmd_puts("Directory was removed\n");
                goto unlock;
        }
 
@@ -2648,10 +2646,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
        int ret;
 
        prdtgrp = rdtgroup_kn_lock_live(prgrp_kn);
-       rdt_last_cmd_clear();
        if (!prdtgrp) {
                ret = -ENODEV;
-               rdt_last_cmd_puts("Directory was removed\n");
                goto out_unlock;
        }
 
This page took 0.063628 seconds and 4 git commands to generate.