summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarshana Padmadas <darshanapadmadas@gmail.com>2015-03-28 12:07:14 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-19 10:11:07 +0200
commitaef709320362aa4c86e96e1e48fb6c3aa357d17f (patch)
tree2d6244d3d3f5f633cf9db1ae677c0d8b61ce7d3d
parent1d780d7aa25a0f0081144b5a63db23e16e9ba320 (diff)
downloadlwn-aef709320362aa4c86e96e1e48fb6c3aa357d17f.tar.gz
lwn-aef709320362aa4c86e96e1e48fb6c3aa357d17f.zip
iio: imu: Use iio_trigger_get for indio_dev->trig assignment
commit 4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4 upstream. This patch uses iio_trigger_get to increment the reference count of trigger device, to avoid incorrect assignment. Can result in a null pointer dereference during removal if the trigger has been changed before removal. This patch refers to a similar situation encountered through the following discussion: http://www.spinics.net/lists/linux-iio/msg13669.html Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/imu/adis_trigger.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index e0017c22bb9c..f53e9a803a0e 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
iio_trigger_set_drvdata(adis->trig, adis);
ret = iio_trigger_register(adis->trig);
- indio_dev->trig = adis->trig;
+ indio_dev->trig = iio_trigger_get(adis->trig);
if (ret)
goto error_free_irq;