From patchwork Mon Dec 28 12:41:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 352660 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9770960jai; Mon, 28 Dec 2020 06:05:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpsgWuCMIYGHQOPna1y5SVt9FdcPnFcQFr2feq7L5xvWe5btlv3bN4ERQiZ6Ve+ww/j+yj X-Received: by 2002:a50:a6de:: with SMTP id f30mr43412893edc.30.1609164355402; Mon, 28 Dec 2020 06:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164355; cv=none; d=google.com; s=arc-20160816; b=A6sXmyiMuMXxsBJorAzgWj+KyYGWzTGxmJ1TvrNP2wxAdyc/loKZePfY8yccoca/wH gZfkF+BFB5i8DieTcbmO+tOA+6CMEK6QEZ9EpirJivzCfppC/UvzofpXA7YTqsU1mhdQ wNjmlDzToyvwvFSTu9A3MRjv/dy3oNmO4n1FEH+z1KJTaVg66gpPunQS/9q2TK6SMNHs eujM9oUdCjKaPcGrFV1uWnrPvQJT/fTx8UNj+TaZvjoeR0OJDg1bLHLk6ehDxDdNyEA6 gSZ+eEID2ipzAGpVne3RbkeyzAoRJXhDZrtwfRJRY1p6Y72PPH6+pBmXwJUqV24GcIDk NgKA== 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=NF+07/Qv6pyo5HUpdyEyI3edhTsNzmGkbaojaWS3dbiclDg0UpQRbU/hMY4UkZeBV5 UOLC63sEzKGsG4/T0YSTr7ailebbB2yKhK2b1MChHKfXEIOZ3UtVucMkUIq07IExklCM +PtZevwukcGJi6XyBvxWBwzOpBQzbgl/R+sGBGDEK/5wqfA8f6htInUCAv+AEChQ1HpG a6WUJp+KpQI/cekfVT0Y/WwFjcf6+9XXg40uf2eVtQ1gWWsuTtlt7ZVkG00GMtsFkXCz SLeevhJoDbGvNPi4cy1jW8EecvF5Nid2l/GMFQEl0vY/juAovN7iox/jTpJ8P3cJqpHZ x+Dw== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 n9si21183716edi.179.2020.12.28.06.05.55; Mon, 28 Dec 2020 06:05:55 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S2436875AbgL1OCb (ORCPT + 14 others); Mon, 28 Dec 2020 09:02:31 -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 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.27.0 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);