Skip to contentSkip to conversation

security fix for speedstep-smi

PATCH New Bruno Ducrot 1 participant 1 message Jun 11, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security fix for speedstep-smi

Looking around speedstep-smi, there is a lot of call to speedstep_get_state() which is used as an index for the array speedstep_freqs. But speedstep_get_state() will return the value of ebx after a call to a SMI handler. It's not safe IMHO.

 arch/i386/kernel/cpu/cpufreq/speedstep-smi.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +1 -1
@@ -139,7 +139,7 @@ static int speedstep_get_state (void)
 		: "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
 	);
 
-	return state;
+	return (state & 1);
 }
 
 /**
Signature · 4 lines
Bruno Ducrot

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.