Module Name:    src
Committed By:   jruoho
Date:           Thu Oct  6 14:05:26 UTC 2011

Modified Files:
        src/sys/arch/x86/x86: coretemp.c

Log Message:
Like the comment says, also MSR_IA32_EXT_CONFIG is unsafe; use rdmsr_safe().
Fixes the panic reported by njoly@.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/x86/coretemp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.27 src/sys/arch/x86/x86/coretemp.c:1.28
--- src/sys/arch/x86/x86/coretemp.c:1.27	Sat Sep 24 10:52:56 2011
+++ src/sys/arch/x86/x86/coretemp.c	Thu Oct  6 14:05:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.27 2011/09/24 10:52:56 jruoho Exp $ */
+/* $NetBSD: coretemp.c,v 1.28 2011/10/06 14:05:26 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.27 2011/09/24 10:52:56 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.28 2011/10/06 14:05:26 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -281,7 +281,8 @@ coretemp_tjmax(device_t self)
 	if ((model == 0x0F && stepping >= 2) ||
 	    (model == 0x0E && extmodel != 1)) {
 
-		msr = rdmsr(MSR_IA32_EXT_CONFIG);
+		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, &msr) == EFAULT)
+			return;
 
 		if ((msr & __BIT(30)) != 0) {
 			sc->sc_tjmax = 85;

Reply via email to