mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
This commit is contained in:
parent
5edb56491d
commit
053ea64081
1 changed files with 5 additions and 0 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include <linux/uaccess.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#include <linux/i8k.h>
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue