Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5054872rwl; Mon, 3 Apr 2023 13:43:00 -0700 (PDT) X-Google-Smtp-Source: AKy350YXkgUpqcq8vNkjOuh/sdvvUeA1zDw/0ytIa896Pxcb6flQN1yRRv7mtSaEj9Le5dWWhuiM X-Received: by 2002:a17:902:c404:b0:1a1:bf22:2b6e with SMTP id k4-20020a170902c40400b001a1bf222b6emr372600plk.43.1680554579758; Mon, 03 Apr 2023 13:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680554579; cv=none; d=google.com; s=arc-20160816; b=CWIuYodFEpoG4rTGIb//ufGt3zj52Q5xtepgHraVjNQpj2F1OgRU/Hf4R743zjeyCF LHZS02Z96BONAiWnfG4ows795FztpVxciSvX7JziHRttw24JFn9xk9X9vCGuFE5HyMR6 /x52aOtErruMPot+LEqyPl0wLsOpLGpEzw4QMbdNLsDrER95Ue09nqvEqPxKqDYLgttw gpkSYCg5UWE7YRXGM0+6KvlXds6T0CLVVScuT1e4wMiW/rAGPngg4DZNwKtYgVMV51qn V/crph3DXc//8RsUDHHQIgtD6k8Y2bzTz1c/GTaJF9hb1aLbgnjdVzFWsGTzJi0jPYGM RNxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dURY1xCpHXDLXAfUlVyn8rjCxWMcqqi+PH/vEcs4z5g=; b=D0rcKFEI5EZDI4zBV+e04UK+YxVZQs2I1Ya0hzDlYG2JM0vogOHlcKYEMDNX+qB3iC q7sqG6EUu+jncB2I0fM3lCuoRZzsOjx8+IE9hWFybGeoA3DNmZiw7Tr+6lDcJ0759T/a UYl9DbRPRjSPRLqeVBRZ73BCoXwqpt6au/cDlyhR51S9MtDF+TZ7j9bBy/YLf6wtja1v ijn7GJwxQK9hU5rDmhJSxQmg+/RfPrs+t/nfaEWwUKO83GfMyHhB749SOOwxhXGZGVfZ mueRIYrMfU4e5+q2L/YiYO63SXf+26nnTd9Nf2iZoZAHKMIj2VzMiFY/m2r8p9SLW483 aGuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ICr5otNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w2-20020a170902904200b001a1c9827119si3280548plz.38.2023.04.03.13.42.47; Mon, 03 Apr 2023 13:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ICr5otNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233364AbjDCUgt (ORCPT + 99 others); Mon, 3 Apr 2023 16:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231933AbjDCUgp (ORCPT ); Mon, 3 Apr 2023 16:36:45 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E71A448E for ; Mon, 3 Apr 2023 13:36:29 -0700 (PDT) Received: from zn.tnic (p5de8e687.dip0.t-ipconnect.de [93.232.230.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id D9C9A1EC01A9; Mon, 3 Apr 2023 22:36:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1680554187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=dURY1xCpHXDLXAfUlVyn8rjCxWMcqqi+PH/vEcs4z5g=; b=ICr5otNGdMU0EdM8Cn5TYhOfU1Ydt/YWGbdIIhReI0kzu/52rRpi/D/kxSXXfA35D2lBj7 yx34UcFvFEgkTRbLYLEK40/zhwrtMBq6prlIXKUUeeXfKXCnOp7SjI9mEhgjON3asyB+hc euVlPMWcWWNC476TW8bMOATeRolUeyU= Date: Mon, 3 Apr 2023 22:36:23 +0200 From: Borislav Petkov To: Yazen Ghannam Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/amd_nb: Check for invalid SMN reads Message-ID: <20230403203623.GDZCs4x5yVReaPVOaS@fat_crate.local> References: <20230403164244.471141-1-yazen.ghannam@amd.com> <20230403193245.GCZCsp3RjNZFSE5f9s@fat_crate.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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