Skip to content

Commit 1be4e29

Browse files
superm1ij-intel
authored andcommitted
platform/x86/amd/pmf: Initialize and clean up cb_mutex
`cb_mutex` was introduced in commit 9e0894d ("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 <Yijun.Shen@dell.com> Cc: Richard Gong <richgong@amd.com> Fixes: 9e0894d ("platform/x86/amd/pmf: Enable Custom BIOS Inputs for PMF-TA") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Tested-By: Yijun Shen <Yijun_Shen@Dell.com> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20250227170308.435862-1-superm1@kernel.org Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent b3e127d commit 1be4e29

File tree

1 file changed

+2
-0
lines changed
  • drivers/platform/x86/amd/pmf

1 file changed

+2
-0
lines changed

drivers/platform/x86/amd/pmf/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ static int amd_pmf_probe(struct platform_device *pdev)
452452

453453
mutex_init(&dev->lock);
454454
mutex_init(&dev->update_mutex);
455+
mutex_init(&dev->cb_mutex);
455456

456457
apmf_acpi_init(dev);
457458
platform_set_drvdata(pdev, dev);
@@ -477,6 +478,7 @@ static void amd_pmf_remove(struct platform_device *pdev)
477478
amd_pmf_dbgfs_unregister(dev);
478479
mutex_destroy(&dev->lock);
479480
mutex_destroy(&dev->update_mutex);
481+
mutex_destroy(&dev->cb_mutex);
480482
kfree(dev->buf);
481483
}
482484

0 commit comments

Comments
 (0)