Patch "Revert "iio:humidity:si7020: fix pointer to i2c client"" has been added to the 3.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Revert "iio:humidity:si7020: fix pointer to i2c client"

to the 3.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     revert-iio-humidity-si7020-fix-pointer-to-i2c-client.patch
and it can be found in the queue-3.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From e765537add38cf7967efa11999bb5daf84a6517d Mon Sep 17 00:00:00 2001
From: Jonathan Cameron <jic23@xxxxxxxxxx>
Date: Sat, 14 Feb 2015 11:32:17 +0000
Subject: Revert "iio:humidity:si7020: fix pointer to i2c client"

From: Jonathan Cameron <jic23@xxxxxxxxxx>

commit e765537add38cf7967efa11999bb5daf84a6517d upstream.

This reverts commit e0922e5e3ccb78aa0152e93dfbd1755ac39c8582.
Requested by Andrey Smirnov.

It incorrectly assumes that the level of indirection is not needed
which is not true(probably because the driver incorrectly allocates
sizeof(*client) instead of sizeof(*data) via devm_iio_device_alloc).
If you look at the code of the probe function(see below) it is easy to
see that what is being stored in the private memory of the IIO device
instance is not a copy of a 'struct i2c_client' but a pointer to an
instance passed as an argument to the probe function.

struct i2c_client **data;
int ret;

< Some code skipped >

indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client));
if (!indio_dev)
return -ENOMEM;

data = iio_priv(indio_dev);
*data = client;

Without reverting this change any read of a raw value of this sensor
leads to a kernel oops due to a NULL pointer de-reference on my
hardware setup.

Signed-off-by: Jonathan Cameron <jic23@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 drivers/iio/humidity/si7020.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/iio/humidity/si7020.c
+++ b/drivers/iio/humidity/si7020.c
@@ -45,12 +45,12 @@ static int si7020_read_raw(struct iio_de
 			   struct iio_chan_spec const *chan, int *val,
 			   int *val2, long mask)
 {
-	struct i2c_client *client = iio_priv(indio_dev);
+	struct i2c_client **client = iio_priv(indio_dev);
 	int ret;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
-		ret = i2c_smbus_read_word_data(client,
+		ret = i2c_smbus_read_word_data(*client,
 					       chan->type == IIO_TEMP ?
 					       SI7020CMD_TEMP_HOLD :
 					       SI7020CMD_RH_HOLD);


Patches currently in stable-queue which might be from jic23@xxxxxxxxxx are

queue-3.19/iio-adc-mcp3422-fix-incorrect-scales-table.patch
queue-3.19/iio-ad5686-fix-optional-reference-voltage-declaration.patch
queue-3.19/iio-mxs-lradc-separate-touchscreen-and-buffer-virtual-channels.patch
queue-3.19/revert-iio-humidity-si7020-fix-pointer-to-i2c-client.patch
queue-3.19/iio-mxs-lradc-make-adc-reads-not-disable-touchscreen-interrupts.patch
queue-3.19/iio-mxs-lradc-fix-iio-channel-map-regression.patch
queue-3.19/iio-si7020-allocate-correct-amount-of-memory-in-devm_iio_device_alloc.patch
queue-3.19/iio-mxs-lradc-make-adc-reads-not-unschedule-touchscreen-conversions.patch
queue-3.19/iio-imu-adis16400-fix-sign-extension.patch
queue-3.19/iio-mxs-lradc-only-update-the-buffer-when-its-conversions-have-finished.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]