stm class: Prevent user-controllable allocations
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Tue, 22 Dec 2015 15:25:21 +0000 (17:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 06:43:17 +0000 (22:43 -0800)
commitf08b18266c7116e2ec6885dd53a928f580060a71
tree90487bb127914a64084190520a3517f1d5137150
parent7b3bb0e75395b2f3b0f95d9ae50581e989ba5e4c
stm class: Prevent user-controllable allocations

Currently, the character device write method allocates a temporary buffer
for user's data, but the user's data size is not sanitized and can cause
arbitrarily large allocations via kzalloc() or an integer overflow that
will then result in overwriting kernel memory.

This patch trims the input buffer size to avoid these issues.

Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/stm/core.c