]> www.infradead.org Git - users/jedix/linux-maple.git/commit
platform/x86/amd: pmf: Use device managed allocations
authorMario Limonciello <mario.limonciello@amd.com>
Thu, 22 May 2025 00:34:55 +0000 (19:34 -0500)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 10 Jun 2025 07:42:11 +0000 (10:42 +0300)
commitd9db3a941270d92bbd1a6a6b54a10324484f2f2d
tree92018713b936c0942402c712dbc5ee4a799af470
parent784e48a82976ee0b645788750343cd1b28a372f3
platform/x86/amd: pmf: Use device managed allocations

If setting up smart PC fails for any reason then this can lead to
a double free when unloading amd-pmf.  This is because dev->buf was
freed but never set to NULL and is again freed in amd_pmf_remove().

To avoid subtle allocation bugs in failures leading to a double free
change all allocations into device managed allocations.

Fixes: 5b1122fc4995f ("platform/x86/amd/pmf: fix cleanup in amd_pmf_init_smart_pc()")
Link: https://lore.kernel.org/r/20250512211154.2510397-2-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20250522003457.1516679-2-superm1@kernel.org
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmf/core.c
drivers/platform/x86/amd/pmf/tee-if.c