Message ID | 20230121213512.251578-3-ashok.raj@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp887995wrn; Sat, 21 Jan 2023 13:37:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXuE1K/AUYd0H102aAEscTO+/mhFQ/WhygWYJ98KE7BIpCajurURFokEPxgP5vzvcyzLuGDO X-Received: by 2002:a05:6a00:1887:b0:58c:b0a:e504 with SMTP id x7-20020a056a00188700b0058c0b0ae504mr27385053pfh.18.1674337047297; Sat, 21 Jan 2023 13:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674337047; cv=none; d=google.com; s=arc-20160816; b=fjqpyL0iQjkiIgNhBtcAI6KqaMxjJymNbTbdClgV5ktIoKwPK2kNVtLxLlgQlGnlDi eO3Oz3S6h2NERNZfB/9Hn1jt6494xvO1/9wow0+GIIl+VFu0JmNP491FPB5DXWpt42K9 tonzP/NIq3fjJw5VXLnlGSY9hcPCfuNvqvvQHqGBpB6S75FTC5v/ybuYOgIFp1QRPJoi f/mT2aXv6j/Ge9fkSP7L02qbJVaOwlu1DPoq5K7IG7+HQ3jxdlRkUwZdpnpOhL4/hDUV 6CRKA+cS9hIYXa4EeKlAL1mU9haAA/dC/rTWK0+ZLZrib2W93zSpBvpXLu79zd8QZB1f PDUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TX4IBgpOxu5zTgv0JjYNtlPaJO25OFfzgjlxwm6GkW4=; b=LFLxUIbNpJVA6WdMVEPRhv4Z0l7t0pEW+/oaYD+bYulgloO7xDQBI6Iz2DxoMElBTQ rz2iBUWUP9NiaLSJdtK5usK3RGdcXgA3gEPyaP18H/4mXuYHl4IM1FJxackV2WKf1DgA 7wwE2HbQ+BoVAWtksy3LfalLyyhvi/TIfJJdbts3nAFf0QyhKyEkBAgsZeVcH/kWTlOQ ohmxacRLgE25/6At8cLbZ/WqP7IT4p6gZADHUS1q+OwATeu03ankefLqlxUeGBVclygF gWK8syQEPVIr8VVHyFofVHQHLshseidtJqXT0yg3rg4+ZhHO3sJRVwUrhj1XDxayh9wH v54Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kVpRG872; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f2-20020a056a0022c200b0058bc7462962si26160202pfj.80.2023.01.21.13.37.15; Sat, 21 Jan 2023 13:37:27 -0800 (PST) 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=@intel.com header.s=Intel header.b=kVpRG872; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjAUVfa (ORCPT <rfc822;forouhar.linux@gmail.com> + 99 others); Sat, 21 Jan 2023 16:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbjAUVfZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 21 Jan 2023 16:35:25 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86CA723DA1 for <linux-kernel@vger.kernel.org>; Sat, 21 Jan 2023 13:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674336924; x=1705872924; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U7lNHeyeMGQVevEMDm/Srbh6wwfqpxVEAKNnbxAm03o=; b=kVpRG872jpQcz4m3cRh4WeVW7ZDoC8GojixXb8CEjN+D2uS9CcqMMcuP +D1VEsVAV2EEjfPam79nXd3L9p8VngdjViTQCtoSNhS5agoMNg3aY+c6B VFHzcFqvCyFkn021SpsoL1KNtA0qQMMLHkr4yJccXhiHlR2/w/OpmjlMT 9S4ttwdAAHdexXuFQsLPGshnjZRiM3SxgZ3W5wcsMgQszv2sT2vsKaUGP 34B1btdGPz0ndPjSoxTggRPAoxJBdgkfCDKg7z0Ol4hdc5sAShjq6zA2k m2bMvoyxSx/nNxAXnLDU/vXxFjicKvxYI/kuVFq2CVVChmrByQrYuQcXF w==; X-IronPort-AV: E=McAfee;i="6500,9779,10597"; a="412066320" X-IronPort-AV: E=Sophos;i="5.97,235,1669104000"; d="scan'208";a="412066320" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2023 13:35:22 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10597"; a="784946313" X-IronPort-AV: E=Sophos;i="5.97,235,1669104000"; d="scan'208";a="784946313" Received: from araj-ucode.jf.intel.com ([10.23.0.19]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jan 2023 13:35:21 -0800 From: Ashok Raj <ashok.raj@intel.com> To: Thomas Gleixner <tglx@linutronix.de>, Borislav Petkov <bp@alien8.de> Cc: Ashok Raj <ashok.raj@intel.com>, LKML <linux-kernel@vger.kernel.org>, x86 <x86@kernel.org>, Ingo Molnar <mingo@kernel.org>, Tony Luck <tony.luck@intel.com>, Dave Hansen <dave.hansen@intel.com>, Alison Schofield <alison.schofield@intel.com>, Reinette Chatre <reinette.chatre@intel.com>, Tom Lendacky <thomas.lendacky@amd.com>, Stefan Talpalaru <stefantalpalaru@yahoo.com>, David Woodhouse <dwmw2@infradead.org>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Jonathan Corbet <corbet@lwn.net>, "Rafael J . Wysocki" <rafael@kernel.org>, Peter Zilstra <peterz@infradead.org>, Andy Lutomirski <luto@kernel.org>, Andrew Cooper <Andrew.Cooper3@citrix.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, Martin Pohlack <mpohlack@amazon.de> Subject: [Part 2 v2[cleanup] 2/4] x86/microcode: Report invalid writes to reload sysfs file Date: Sat, 21 Jan 2023 13:35:10 -0800 Message-Id: <20230121213512.251578-3-ashok.raj@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230121213512.251578-1-ashok.raj@intel.com> References: <87y1pygiyf.ffs@tglx> <20230121213512.251578-1-ashok.raj@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755669643822003968?= X-GMAIL-MSGID: =?utf-8?q?1755669643822003968?= |
Series |
[Part,2,v2[cleanup] 2/4] x86/microcode: Report invalid writes to reload sysfs file
|
|
Commit Message
Ashok Raj
Jan. 21, 2023, 9:35 p.m. UTC
Currently microcode reload sysfs file only accepts a value of 1. But when
user writes other values we don't report error, but just treat them as
silent success without performing a load.
Report those erroneous writes back to user.
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: x86 <x86@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: Thomas Gleixner (Intel) <tglx@linutronix.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Stefan Talpalaru <stefantalpalaru@yahoo.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Peter Zilstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Martin Pohlack <mpohlack@amazon.de>
---
arch/x86/kernel/cpu/microcode/core.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index c5d80ff00b4e..6ade3d59c404 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -479,11 +479,8 @@ static ssize_t reload_store(struct device *dev, ssize_t ret = 0; ret = kstrtoul(buf, 0, &val); - if (ret) - return ret; - - if (val != 1) - return size; + if (ret || val != 1) + return -EINVAL; cpus_read_lock();