The 14-byte legacy fan payload contains 2 control bytes followed by 6
16-bit fan values. However, the existing check also accepts IDs 6 and 7.
ID 6 stores its value in the last 2 bytes of the buffer, but outside the
transmitted payload, while ID 7 writes beyond the 16-byte buffer.
Reject IDs greater than 5 for legacy fan commands.
Fixes: 75722d3992f5 ("[PATCH] ppc64: Thermal control for SMU based machines")
Signed-off-by: Thorsten Blum <[email protected]>
---
drivers/macintosh/windfarm_smu_controls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/macintosh/windfarm_smu_controls.c
b/drivers/macintosh/windfarm_smu_controls.c
index 9adceae74345..f430f160f246 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -74,7 +74,7 @@ static int smu_set_fan(int pwm, u8 id, u16 value)
*((u16 *)(&buffer[2])) = value;
cmd.data_len = 4;
} else {
- if (id > 7)
+ if (id > 5)
return -EINVAL;
/* Fill argument buffer */
memset(buffer, 0, 16);