Skip to content

Commit

Permalink
hwmon: (dell-smm) Fail in ioctl I8K_BIOS_VERSION when bios version is…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Pali Rohár authored and Guenter Roeck committed Jun 18, 2016
1 parent 5edb564 commit 053ea64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/hwmon/dell-smm-hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/sched.h>
#include <linux/ctype.h>

#include <linux/i8k.h>

Expand Down Expand Up @@ -387,6 +388,10 @@ i8k_ioctl_unlocked(struct file *fp, unsigned int cmd, unsigned long arg)

switch (cmd) {
case I8K_BIOS_VERSION:
if (!isdigit(bios_version[0]) || !isdigit(bios_version[1]) ||
!isdigit(bios_version[2]))
return -EINVAL;

val = (bios_version[0] << 16) |
(bios_version[1] << 8) | bios_version[2];
break;
Expand Down

0 comments on commit 053ea64

Please sign in to comment.