Skip to content
Commit 096cdc6f authored by Dan Carpenter's avatar Dan Carpenter Committed by Olof Johansson
Browse files

platform/chrome: cros_ec_dev - double fetch bug in ioctl



We verify "u_cmd.outsize" and "u_cmd.insize" but we need to make sure
that those values have not changed between the two copy_from_user()
calls.  Otherwise it could lead to a buffer overflow.

Additionally, cros_ec_cmd_xfer() can set s_cmd->insize to a lower value.
We should use the new smaller value so we don't copy too much data to
the user.

Reported-by: default avatarPengfei Wang <wpengfeinudt@gmail.com>
Fixes: a8411784

 ('mfd: cros_ec: Use a zero-length array for command data')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Tested-by: default avatarGwendal Grignou <gwendal@chromium.org>
Cc: <stable@vger.kernel.org> # v4.2+
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parent 33688abb
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment