Skip to content

Commit 76d41fb

Browse files
superm1jwrdegoede
authored andcommitted
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: 10817f2 ("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>
1 parent e709615 commit 76d41fb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/platform/x86/amd/pmf/tee-if.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
456456
memcpy(dev->policy_buf, dev->policy_base, dev->policy_sz);
457457

458458
amd_pmf_hex_dump_pb(dev);
459-
if (pb_side_load)
460-
amd_pmf_open_pb(dev, dev->dbgfs_dir);
461459

462460
dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
463461
if (!dev->prev_data)
@@ -467,6 +465,9 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
467465
if (ret)
468466
goto error;
469467

468+
if (pb_side_load)
469+
amd_pmf_open_pb(dev, dev->dbgfs_dir);
470+
470471
return 0;
471472

472473
error:

0 commit comments

Comments
 (0)