diff options
author | 2022-01-02 10:36:09 -0800 | |
---|---|---|
committer | 2022-01-02 10:36:09 -0800 | |
commit | 859431ac11aef9b4cd7ffa75e94a92a6a41c8623 (patch) | |
tree | b2b6b812e7aba7c0159e05cfc972edde5e00658f /drivers/i2c | |
parent | Merge tag 'x86_urgent_for_v5.16_rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip (diff) | |
parent | Docs: Fixes link to I2C specification (diff) | |
download | wireguard-linux-859431ac11aef9b4cd7ffa75e94a92a6a41c8623.tar.xz wireguard-linux-859431ac11aef9b4cd7ffa75e94a92a6a41c8623.zip |
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang:
"Better input validation for compat ioctls and a documentation bugfix
for 5.16"
* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
Docs: Fixes link to I2C specification
i2c: validate user data in compat ioctl
Diffstat (limited to '')
-rw-r--r-- | drivers/i2c/i2c-dev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index bce0e8bb7852..cf5d049342ea 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -535,6 +535,9 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo sizeof(rdwr_arg))) return -EFAULT; + if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0) + return -EINVAL; + if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS) return -EINVAL; |