summaryrefslogtreecommitdiff
path: root/drivers/platform/chrome/cros_ec_proto.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-03-08 09:13:52 -0800
committerOlof Johansson <olof@lixom.net>2016-05-11 11:55:47 -0700
commit5d749d0bbe811c10d9048cde6dfebc761713abfd (patch)
tree7f8497b6fa3125c0f7256dab097a73fbdc34bc58 /drivers/platform/chrome/cros_ec_proto.c
parent492ef7829d2d09428803bffb187d5781bbc12ca5 (diff)
platform/chrome: cros_ec_dev - Fix security issue
Prevent memory scribble by checking that ioctl buffer size parameters are sane. Without this check, on 32 bits system, if .insize = 0xffffffff - 20 and .outsize the amount to scribble, we would overflow, allocate a small amounts and be able to write outside of the malloc'ed area. Adding a hard limit allows argument checking of the ioctl. With the current EC, it is expected .insize and .outsize to be at around 512 bytes or less. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/platform/chrome/cros_ec_proto.c')
-rw-r--r--drivers/platform/chrome/cros_ec_proto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 990308ca384f..b6e161f71b26 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -298,8 +298,8 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
ec_dev->max_response = EC_PROTO2_MAX_PARAM_SIZE;
ec_dev->max_passthru = 0;
ec_dev->pkt_xfer = NULL;
- ec_dev->din_size = EC_MSG_BYTES;
- ec_dev->dout_size = EC_MSG_BYTES;
+ ec_dev->din_size = EC_PROTO2_MSG_BYTES;
+ ec_dev->dout_size = EC_PROTO2_MSG_BYTES;
} else {
/*
* It's possible for a test to occur too early when