Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9132291pxu; Mon, 28 Dec 2020 07:25:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvkhD3Vt8svKc8R5MU6SnPM7CJFmbt8uKVGOogo+B6u+kMM6D6W99nKwznHwHAv30aP5rT X-Received: by 2002:a50:a694:: with SMTP id e20mr42759307edc.261.1609169110940; Mon, 28 Dec 2020 07:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609169110; cv=none; d=google.com; s=arc-20160816; b=LUwXHgcI4OmFryDE9Bq/eQxjBRRwbMcO8xyJZpxacSt03SR0iSNoxF23dvk/i8zvgw g8sSHxC4ADY/6HlGVi/xtqOBdm6tCT72M7xf0S+iDiNG0G20us9IbgBH1a72tAxUuGP1 VXrOgEp5KYSQMAenFp7/Prg65PW/gM7bTRzoXawjVyFpSldefYXYBw0iv3icgCNMNeE8 Dm/8M/Sc6+V+9UuQfE1xouE7UggDeoe/8+a6XgXwCl+HOeyj1GqRG+XyYtPJo4GyvjFy ege+xVK37gklMrYSeyrq/PGFnpGWWbhNyeh7YvQzp/7MWVkhe4Ii+QZqs3EDcfWTW8s/ quHQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wy8gOHtMoSMrN2zpkllTJMKrUNoa36HRFJJiTaKr4so=; b=ibg2U38KmzyfYoJfTL227PDngCHJ8+5sNoYOu8UVcVePGb2vsOZsvWYqqob1eulwYS p3DE9r1YxsG9JRqzMTkVHJxMYQMS+H2nsAqDGK+J6zPjObPN9ZBOPF+dgAFupYh5N4R/ gAfc79UQVz1n/l5wUsnJsamjG9BHMY+z55RKh4Sgv2m8WPty3qDKn7u4Ir7HSmS/zljG K0nFna4JmHtXcU6laqa57vJjZsXyOONXdL7flOwbYVgjab6l2OxWbZRz7EsnSvRHbfqu ZZFC5Zdjg2d2xQaxs+R2/wwNAdPNoRB8h5vKUNEvVZC04ldadJMh774sBp2BXWiRiCfV oiLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="id62iS/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si13376700eds.129.2020.12.28.07.24.48; Mon, 28 Dec 2020 07:25:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="id62iS/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436913AbgL1OCi (ORCPT + 99 others); Mon, 28 Dec 2020 09:02:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:36296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436869AbgL1OCa (ORCPT ); Mon, 28 Dec 2020 09:02:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A2A24207AB; Mon, 28 Dec 2020 14:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164110; bh=CW7sfNxjmiuSU4N04oyKZ7us6J5vXrFyc5Nu30RjiKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=id62iS/uJD1zoy39O/b7Ap18M4ITG6TwJ14ghRKu0q5LAlHpw48MT+RucQD32+NpY vJ16PEYE6EdjMfohPWNJKFp6Bv72utXHTMmcalpAwCiurXW/2rWsQbo17vpKMF+UUm cwIlpUjfHf7O4PujMTz27eWD7pRq4qbIyBg8DEvY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhen Lei , Borislav Petkov , Sasha Levin Subject: [PATCH 5.10 063/717] x86/mce: Correct the detection of invalid notifier priorities Date: Mon, 28 Dec 2020 13:41:01 +0100 Message-Id: <20201228125024.015298296@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhen Lei [ Upstream commit 15af36596ae305aefc8c502c2d3e8c58221709eb ] Commit c9c6d216ed28 ("x86/mce: Rename "first" function as "early"") changed the enumeration of MCE notifier priorities. Correct the check for notifier priorities to cover the new range. [ bp: Rewrite commit message, remove superfluous brackets in conditional. ] Fixes: c9c6d216ed28 ("x86/mce: Rename "first" function as "early"") Signed-off-by: Zhen Lei Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20201106141216.2062-2-thunder.leizhen@huawei.com Signed-off-by: Sasha Levin --- arch/x86/include/asm/mce.h | 3 ++- arch/x86/kernel/cpu/mce/core.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h index a0f147893a041..fc25c88c7ff29 100644 --- a/arch/x86/include/asm/mce.h +++ b/arch/x86/include/asm/mce.h @@ -177,7 +177,8 @@ enum mce_notifier_prios { MCE_PRIO_EXTLOG, MCE_PRIO_UC, MCE_PRIO_EARLY, - MCE_PRIO_CEC + MCE_PRIO_CEC, + MCE_PRIO_HIGHEST = MCE_PRIO_CEC }; struct notifier_block; diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 32b7099e35111..311688202ea51 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -162,7 +162,8 @@ EXPORT_SYMBOL_GPL(mce_log); void mce_register_decode_chain(struct notifier_block *nb) { - if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC)) + if (WARN_ON(nb->priority < MCE_PRIO_LOWEST || + nb->priority > MCE_PRIO_HIGHEST)) return; blocking_notifier_chain_register(&x86_mce_decoder_chain, nb); -- 2.27.0