i2c: fix kernel memory disclosure in dev interface
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Mon, 9 Jan 2017 15:53:36 +0000 (22:53 +0700)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 12:04:06 +0000 (14:04 +0200)
commit 30f939feaeee23e21391cfc7b484f012eb189c3c upstream.

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>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/i2c/i2c-dev.c

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