Re: [PATCH] x86/amd_nb: Check for invalid SMN reads
From: Yazen Ghannam
Date: Mon Apr 03 2023 - 17:39:49 EST
On 4/3/23 16:36, Borislav Petkov wrote:
> On Mon, Apr 03, 2023 at 03:40:38PM -0400, Yazen Ghannam wrote:
>> I don't think pci_write_config*() sets the PCI Error response like
>> pci_read_config(), AFAICT.
>
> diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
> index 4266b64631a4..c4caade434a7 100644
> --- a/arch/x86/kernel/amd_nb.c
> +++ b/arch/x86/kernel/amd_nb.c
> @@ -181,6 +181,13 @@ static int __amd_smn_rw(u16 node, u32 address, u32 *value, bool write)
> pr_warn("Error %s SMN address 0x%x.\n",
> (write ? "writing to" : "reading from"), address);
>
> + if (!write) {
> + if (PCI_POSSIBLE_ERROR(*value)) {
> + err = -ENODEV;
> + *value = 0;
> + }
> + }
> +
> out_unlock:
> mutex_unlock(&smn_mutex);
>
>
Yes, that's fine. Should I send another revision?
Thanks,
Yazen