Commit 2545deba authored by Jithu Joseph's avatar Jithu Joseph Committed by Hans de Goede

platform/x86/intel/ifs: release cpus_read_lock()

Couple of error paths in do_core_test() was returning directly without
doing a necessary cpus_read_unlock().

Following lockdep warning was observed when exercising these scenarios
with PROVE_RAW_LOCK_NESTING enabled:

[  139.304775] ================================================
[  139.311185] WARNING: lock held when returning to user space!
[  139.317593] 6.6.0-rc2ifs01+ #11 Tainted: G S      W I
[  139.324499] ------------------------------------------------
[  139.330908] bash/11476 is leaving the kernel with locks still held!
[  139.338000] 1 lock held by bash/11476:
[  139.342262]  #0: ffffffffaa26c930 (cpu_hotplug_lock){++++}-{0:0}, at:
do_core_test+0x35/0x1c0 [intel_ifs]

Fix the flow so that all scenarios release the lock prior to returning
from the function.

Fixes: 5210fb4e ("platform/x86/intel/ifs: Sysfs interface for Array BIST")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJithu Joseph <jithu.joseph@intel.com>
Link: https://lore.kernel.org/r/20230927184824.2566086-1-jithu.joseph@intel.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 981368e1
...@@ -331,14 +331,15 @@ int do_core_test(int cpu, struct device *dev) ...@@ -331,14 +331,15 @@ int do_core_test(int cpu, struct device *dev)
switch (test->test_num) { switch (test->test_num) {
case IFS_TYPE_SAF: case IFS_TYPE_SAF:
if (!ifsd->loaded) if (!ifsd->loaded)
return -EPERM; ret = -EPERM;
else
ifs_test_core(cpu, dev); ifs_test_core(cpu, dev);
break; break;
case IFS_TYPE_ARRAY_BIST: case IFS_TYPE_ARRAY_BIST:
ifs_array_test_core(cpu, dev); ifs_array_test_core(cpu, dev);
break; break;
default: default:
return -EINVAL; ret = -EINVAL;
} }
out: out:
cpus_read_unlock(); cpus_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment