diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-06 19:07:23 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-06 19:07:23 +0300 |
commit | 4d0a279c7c9965d080c029f85b9e7fa4a8e1973e (patch) | |
tree | 233fef2f0a9c1ea216a98ef2f28057f79c7c905b | |
parent | a99cde438de0c4c0cecc1d1af1a55a75b10bfdef (diff) | |
parent | 096cdc6f52225835ff503f987a0d68ef770bb78e (diff) | |
download | linux-4d0a279c7c9965d080c029f85b9e7fa4a8e1973e.tar.xz |
Merge tag 'chrome-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform
Pull chrome platform fix from Olof Johansson:
"A single fix this time, closing a window where ioctl args are fetched
twice"
* tag 'chrome-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
platform/chrome: cros_ec_dev - double fetch bug in ioctl
-rw-r--r-- | drivers/platform/chrome/cros_ec_dev.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c index 6d8ee3b15872..8abd80dbcbed 100644 --- a/drivers/platform/chrome/cros_ec_dev.c +++ b/drivers/platform/chrome/cros_ec_dev.c @@ -151,13 +151,19 @@ static long ec_device_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg) goto exit; } + if (u_cmd.outsize != s_cmd->outsize || + u_cmd.insize != s_cmd->insize) { + ret = -EINVAL; + goto exit; + } + s_cmd->command += ec->cmd_offset; ret = cros_ec_cmd_xfer(ec->ec_dev, s_cmd); /* Only copy data to userland if data was received. */ if (ret < 0) goto exit; - if (copy_to_user(arg, s_cmd, sizeof(*s_cmd) + u_cmd.insize)) + if (copy_to_user(arg, s_cmd, sizeof(*s_cmd) + s_cmd->insize)) ret = -EFAULT; exit: kfree(s_cmd); |