Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71c488f3 authored by Dan Carpenter's avatar Dan Carpenter Committed by Alexander Shishkin
Browse files

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: 7bd1d409 ("stm class: Introduce an abstraction for System Trace Module devices")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
parent 5771a8c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;

	/*