Skip to content

Commit

Permalink
x86/mce: Correct the detection of invalid notifier priorities
Browse files Browse the repository at this point in the history
[ Upstream commit 15af365 ]

Commit

  c9c6d21 ("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: c9c6d21 ("x86/mce: Rename "first" function as "early"")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201106141216.2062-2-thunder.leizhen@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhen Lei authored and gregkh committed Dec 30, 2020
1 parent c306918 commit 2aa2d48
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion arch/x86/include/asm/mce.h
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/kernel/cpu/mce/core.c
Expand Up @@ -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);
Expand Down

0 comments on commit 2aa2d48

Please sign in to comment.