diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-08-10 15:45:10 +0300 |
---|---|---|
committer | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2017-08-25 17:58:33 +0300 |
commit | 71c488f32b071bfb5cfe9ddf682cd2e0c310c75d (patch) | |
tree | 482f84d4198c043cfd7f7540438362a25aa73d05 /drivers/hwtracing | |
parent | 5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff) | |
download | op-kernel-dev-71c488f32b071bfb5cfe9ddf682cd2e0c310c75d.zip op-kernel-dev-71c488f32b071bfb5cfe9ddf682cd2e0c310c75d.tar.gz |
stm: Potential read overflow in stm_char_policy_set_ioctl()
The "size" variable comes from the user so we need to verify that it's
large enough to hold an stp_policy_id struct.
Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r-- | drivers/hwtracing/stm/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index 0e73114..9414900 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -566,7 +566,7 @@ static int stm_char_policy_set_ioctl(struct stm_file *stmf, void __user *arg) if (copy_from_user(&size, arg, sizeof(size))) return -EFAULT; - if (size >= PATH_MAX + sizeof(*id)) + if (size < sizeof(*id) || size >= PATH_MAX + sizeof(*id)) return -EINVAL; /* |