aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Limonciello <[email protected]>2025-02-27 17:03:06 +0000
committerIlpo Järvinen <[email protected]>2025-03-03 10:48:22 +0000
commit1be4e29e94a6be77de3bc210820b74f40814f17a (patch)
tree0110698d80840621ac5bb42709e8cff0ad0137d3
parentplatform/x86: thinkpad_acpi: Fix registration of tpacpi platform driver (diff)
downloadkernel-1be4e29e94a6be77de3bc210820b74f40814f17a.tar.gz
kernel-1be4e29e94a6be77de3bc210820b74f40814f17a.zip
platform/x86/amd/pmf: Initialize and clean up `cb_mutex`
`cb_mutex` was introduced in commit 9e0894d07072e ("platform/x86/amd/pmf: Enable Custom BIOS Inputs for PMF-TA") to prevent conccurrent access for BIOS inputs. It however isn't initialized and so on use it may lead to a NULL pointer dereference. Add code to initialize on probe and clean up on destroy. Reported-by: Yijun Shen <[email protected]> Cc: Richard Gong <[email protected]> Fixes: 9e0894d07072e ("platform/x86/amd/pmf: Enable Custom BIOS Inputs for PMF-TA") Signed-off-by: Mario Limonciello <[email protected]> Tested-By: Yijun Shen <[email protected]> Acked-by: Shyam Sundar S K <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
-rw-r--r--drivers/platform/x86/amd/pmf/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c
index 764cc1fe90ae..a2cb2d5544f5 100644
--- a/drivers/platform/x86/amd/pmf/core.c
+++ b/drivers/platform/x86/amd/pmf/core.c
@@ -452,6 +452,7 @@ static int amd_pmf_probe(struct platform_device *pdev)
mutex_init(&dev->lock);
mutex_init(&dev->update_mutex);
+ mutex_init(&dev->cb_mutex);
apmf_acpi_init(dev);
platform_set_drvdata(pdev, dev);
@@ -477,6 +478,7 @@ static void amd_pmf_remove(struct platform_device *pdev)
amd_pmf_dbgfs_unregister(dev);
mutex_destroy(&dev->lock);
mutex_destroy(&dev->update_mutex);
+ mutex_destroy(&dev->cb_mutex);
kfree(dev->buf);
}