Skip to content

Commit

Permalink
iio: imu: Use iio_trigger_get for indio_dev->trig assignment
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Darshana Padmadas authored and Jonathan Cameron committed Mar 28, 2015
1 parent f54e9f2 commit 4ce7ca8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/imu/adis_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4ce7ca8

Please sign in to comment.