diff mbox series

[3/6] x86/mce: Fix possibly incorrect severity calculation on AMD

Message ID 20191210000733.17979-4-jschoenh@amazon.de (mailing list archive)
State New, archived
Headers show
Series x86/mce: Various fixes and cleanups for MCE handling | expand

Commit Message

Jan H. Schönherr Dec. 10, 2019, 12:07 a.m. UTC
The function mce_severity_amd_smca() requires m->bank to be initialized
for correct operation. Fix the one case, where mce_severity() is called
without doing so.

Fixes: 6bda529ec42e ("x86/mce: Grade uncorrected errors for SMCA-enabled systems")
Fixes: d28af26faa0b ("x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out()")
Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
---
 arch/x86/kernel/cpu/mce/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Borislav Petkov Dec. 16, 2019, 5:26 p.m. UTC | #1
On Tue, Dec 10, 2019 at 01:07:30AM +0100, Jan H. Schönherr wrote:
> The function mce_severity_amd_smca() requires m->bank to be initialized
> for correct operation. Fix the one case, where mce_severity() is called
> without doing so.
> 
> Fixes: 6bda529ec42e ("x86/mce: Grade uncorrected errors for SMCA-enabled systems")
> Fixes: d28af26faa0b ("x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out()")
> Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
> ---
>  arch/x86/kernel/cpu/mce/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 81ab25d5357a..6afb9de251f2 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -809,8 +809,8 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
>  		if (quirk_no_way_out)
>  			quirk_no_way_out(i, m, regs);
>  
> +		m->bank = i;
>  		if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) {
> -			m->bank = i;
>  			mce_read_aux(m, i);
>  			*msg = tmp;
>  			return 1;
> -- 

Good catch. This should go to Linus now.

Yazen, any objections?
Yazen Ghannam Dec. 16, 2019, 5:35 p.m. UTC | #2
> -----Original Message-----
> From: Borislav Petkov <bp@alien8.de>
> Sent: Monday, December 16, 2019 12:26 PM
> To: Jan H. Schönherr <jschoenh@amazon.de>; Ghannam, Yazen <Yazen.Ghannam@amd.com>
> Cc: Tony Luck <tony.luck@intel.com>; linux-edac@vger.kernel.org; Thomas Gleixner <tglx@linutronix.de>; Ingo Molnar
> <mingo@redhat.com>; H. Peter Anvin <hpa@zytor.com>; x86@kernel.org
> Subject: Re: [PATCH 3/6] x86/mce: Fix possibly incorrect severity calculation on AMD
> 
> On Tue, Dec 10, 2019 at 01:07:30AM +0100, Jan H. Schönherr wrote:
> > The function mce_severity_amd_smca() requires m->bank to be initialized
> > for correct operation. Fix the one case, where mce_severity() is called
> > without doing so.
> >
> > Fixes: 6bda529ec42e ("x86/mce: Grade uncorrected errors for SMCA-enabled systems")
> > Fixes: d28af26faa0b ("x86/MCE: Initialize mce.bank in the case of a fatal error in mce_no_way_out()")
> > Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
> > ---
> >  arch/x86/kernel/cpu/mce/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> > index 81ab25d5357a..6afb9de251f2 100644
> > --- a/arch/x86/kernel/cpu/mce/core.c
> > +++ b/arch/x86/kernel/cpu/mce/core.c
> > @@ -809,8 +809,8 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
> >  		if (quirk_no_way_out)
> >  			quirk_no_way_out(i, m, regs);
> >
> > +		m->bank = i;
> >  		if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) {
> > -			m->bank = i;
> >  			mce_read_aux(m, i);
> >  			*msg = tmp;
> >  			return 1;
> > --
> 
> Good catch. This should go to Linus now.
> 
> Yazen, any objections?
> 

No objections.

Thanks,
Yazen
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 81ab25d5357a..6afb9de251f2 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -809,8 +809,8 @@  static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
 		if (quirk_no_way_out)
 			quirk_no_way_out(i, m, regs);
 
+		m->bank = i;
 		if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) {
-			m->bank = i;
 			mce_read_aux(m, i);
 			*msg = tmp;
 			return 1;