i2c: fix kernel memory disclosure in dev interface

i2c_smbus_xfer() does not always fill an entire block, allowing
kernel stack memory disclosure through the temp variable. Clear
it before it's read to.

Signed-off-by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
This commit is contained in:
Vlad Tsyrklevich 2017-01-09 22:53:36 +07:00 committed by Wolfram Sang
parent a121103c92
commit 30f939feae

View File

@ -331,7 +331,7 @@ static noinline int i2cdev_ioctl_smbus(struct i2c_client *client,
unsigned long arg) unsigned long arg)
{ {
struct i2c_smbus_ioctl_data data_arg; struct i2c_smbus_ioctl_data data_arg;
union i2c_smbus_data temp; union i2c_smbus_data temp = {};
int datasize, res; int datasize, res;
if (copy_from_user(&data_arg, if (copy_from_user(&data_arg,