summaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu/adis_trigger.c
diff options
context:
space:
mode:
authorDarshana Padmadas <darshanapadmadas@gmail.com>2015-03-28 07:37:14 +0100
committerJonathan Cameron <jic23@kernel.org>2015-03-28 14:51:40 +0100
commit4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4 (patch)
tree0694ddd5dc9185aa5300c7c1ad32d8a6a128725e /drivers/iio/imu/adis_trigger.c
parentiio: adc: vf610: use ADC clock within specification (diff)
downloadlinux-4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4.tar.xz
linux-4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4.zip
iio: imu: Use iio_trigger_get for indio_dev->trig assignment
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> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu/adis_trigger.c')
-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;