mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Yazen Ghannam <yazen.ghannam@amd.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/amd_nb: Check for invalid SMN reads
Date: Mon, 3 Apr 2023 22:36:23 +0200	[thread overview]
Message-ID: <20230403203623.GDZCs4x5yVReaPVOaS@fat_crate.local> (raw)
In-Reply-To: <abc57738-6ab9-50e6-6c05-5059299d19d1@amd.com>

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);
 

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2023-04-03 20:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 16:42 Yazen Ghannam
2023-04-03 19:32 ` Borislav Petkov
2023-04-03 19:40   ` Yazen Ghannam
2023-04-03 20:36     ` Borislav Petkov [this message]
2023-04-03 21:36       ` Yazen Ghannam
2023-04-05 18:06         ` Borislav Petkov
2023-04-05 18:32           ` Yazen Ghannam
2023-04-05 19:10             ` Yazen Ghannam
2023-05-08 22:01               ` Yazen Ghannam
2023-05-10 11:35               ` Borislav Petkov
2023-05-10 13:56                 ` Yazen Ghannam
2024-06-05 19:40 ` [tip: x86/urgent] " tip-bot2 for Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230403203623.GDZCs4x5yVReaPVOaS@fat_crate.local \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®