platform/x86/amd/pmf: Fix a potential race with policy binary sideload
authorMario Limonciello <mario.limonciello@amd.com>
Sat, 17 Feb 2024 01:56:42 +0000 (19:56 -0600)
committerHans de Goede <hdegoede@redhat.com>
Mon, 19 Feb 2024 12:39:44 +0000 (13:39 +0100)
commit76d41fb063338781e936765b7ed74224215ca178
treeeeb7262853570d9887285e520ffb25976ae27a6b
parente7096150580849429ff3d43dd69a718bb2036be4
platform/x86/amd/pmf: Fix a potential race with policy binary sideload

The debugfs `update_policy` file is created before
amd_pmf_start_policy_engine() has completed, and thus there could be
a possible (albeit unlikely) race between sideloading a policy and the
BIOS policy getting setup.

Move the debugfs file creation after all BIOS policy is setup.

Fixes: 10817f28e533 ("platform/x86/amd/pmf: Add capability to sideload of policy binary")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Closes: https://lore.kernel.org/platform-driver-x86/15df7d02-b0aa-457a-954a-9d280a592843@redhat.com/T/#m2c445f135e5ef9b53184be7fc9df84e15f89d4d9
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20240217015642.113806-1-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/amd/pmf/tee-if.c