platform/x86/amd/pmf: Initialize and clean up `cb_mutex`
Subsystems (2)
PATCH 1/1 platform/x86/amd/pmf: Initialize and clean up `cb_mutex`
From: Mario Limonciello <[email protected]>
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.
--- drivers/platform/x86/amd/pmf/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/amd/pmf/core.c +2 -0
@@ -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); }
Signature · 1 line
2.43.0
Internal Use - Confidential
Quoted 21 lines
-----Original Message-----
From: Mario Limonciello <[email protected]>
Sent: Friday, February 28, 2025 1:03 AM
To: Limonciello, Mario <[email protected]>; Shyam-sundar.S- [email protected]; [email protected]; [email protected]; [email protected]
Cc: Shen, Yijun <[email protected]>; Richard Gong <[email protected]>; [email protected]
Subject: [PATCH] platform/x86/amd/pmf: Initialize and clean upcb_mutex[EXTERNAL EMAIL]
From: Mario Limonciello <[email protected]>
cb_mutexwas introduced in commit9e0894d07072e("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.
Quoted 7 lines
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 Inputsfor PMF-TA")
Signed-off-by Mario Limonciello <[email protected]>
Verified the patch on the issued system, the issue is gone.
Quoted 29 lines
--- drivers/platform/x86/amd/pmf/core.c | 2 +-+- 1 file changed, 2 insertions(+-)drivers/platform/x86/amd/pmf/core.c +1
-1--- 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);}
--
2.43.0
Quoted 31 lines · Yijun
Internal Use - Confidential
Quoted 21 lines
-----Original Message-----
From: Mario Limonciello <[email protected]>
Sent: Friday, February 28, 2025 1:03 AM
To: Limonciello, Mario <[email protected]>; Shyam-sundar.S- [email protected]; [email protected]; [email protected]; [email protected]
Cc: Shen, Yijun <[email protected]>; Richard Gong <[email protected]>; [email protected]
Subject: [PATCH] platform/x86/amd/pmf: Initialize and clean upcb_mutex[EXTERNAL EMAIL]
From: Mario Limonciello <[email protected]>
cb_mutexwas introduced in commit9e0894d07072e("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.Quoted 7 lines
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 Inputsfor PMF-TA")
Signed-off-by Mario Limonciello <[email protected]>
Quoted 4 lines
Verified the patch on the issued system, the issue is gone.
Tested-by Yijun Shen <[email protected]>
Thank you. Looks good.
Quoted 30 lines
Quoted 29 lines
--- drivers/platform/x86/amd/pmf/core.c | 2 ++ 1 file changed, 2 insertions(+)drivers/platform/x86/amd/pmf/core.c +1
-0@@ -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);drivers/platform/x86/amd/pmf/core.c +1
-1@@ -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); } --2.43.0
Ilpo Järvinen
maintainerQuoted 8 lines · Mario Limonciello
cb_mutexwas introduced in commit9e0894d07072e("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.
[...]
Thank you for your contribution, it has been applied to my local review-ilpo-fixes branch. Note it will show up in the public platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86/amd/pmf: Initialize and clean up cb_mutex
commit: 1be4e29e94a6be77de3bc210820b74f40814f17a
--
i.