Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1708595

[PATCH] stm: Potential read overflow in stm_char_policy_set_ioctl()

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject [PATCH] stm: Potential read overflow in stm_char_policy_set_ioctl()
Date 2017-08-10 14:50 +0200
Message-ID <ucV4u-5Dc-21@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 0e731143f6a4..9414900575d8 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;
 
 	/*

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] stm: Potential read overflow in stm_char_policy_set_ioctl() Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-10 14:50 +0200

csiph-web