summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/dell-smm-hwmon.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-06-17 18:54:44 -0400
committerGuenter Roeck <linux@roeck-us.net>2016-06-18 15:55:20 -0400
commit053ea640818812313892ec4f370f5cfac42fd355 (patch)
tree75c74adedf6d7f6725a3ef9466430e3f035443e4 /drivers/hwmon/dell-smm-hwmon.c
parent5edb56491d4812c42175980759da53388e5d86f5 (diff)
hwmon: (dell-smm) Fail in ioctl I8K_BIOS_VERSION when bios version is not a number
ABI of I8K_BIOS_VERSION ioctl can return only number. But new BIOS versions contain also other characters, which does not fit into that ABI. So in case of non digit values return -EINVAL. Reported-by: Mario Limonciello <Mario_Limonciello@dell.com> Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/dell-smm-hwmon.c')
-rw-r--r--drivers/hwmon/dell-smm-hwmon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index c43318d3416e..480b2fae9541 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -35,6 +35,7 @@
35#include <linux/uaccess.h> 35#include <linux/uaccess.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/sched.h> 37#include <linux/sched.h>
38#include <linux/ctype.h>
38 39
39#include <linux/i8k.h> 40#include <linux/i8k.h>
40 41
@@ -387,6 +388,10 @@ i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg)
387 388
388 switch (cmd) { 389 switch (cmd) {
389 case I8K_BIOS_VERSION: 390 case I8K_BIOS_VERSION:
391 if (!isdigit(bios_version[0]) || !isdigit(bios_version[1]) ||
392 !isdigit(bios_version[2]))
393 return -EINVAL;
394
390 val = (bios_version[0] << 16) | 395 val = (bios_version[0] << 16) |
391 (bios_version[1] << 8) | bios_version[2]; 396 (bios_version[1] << 8) | bios_version[2];
392 break; 397 break;