Skip to content

Commit cfb769a

Browse files
darshanapdassashalevin
authored andcommitted
iio: imu: Use iio_trigger_get for indio_dev->trig assignment
[ Upstream commit 4ce7ca8 ] 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> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent dcf72cd commit cfb769a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/iio/imu/adis_trigger.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
6060
iio_trigger_set_drvdata(adis->trig, adis);
6161
ret = iio_trigger_register(adis->trig);
6262

63-
indio_dev->trig = adis->trig;
63+
indio_dev->trig = iio_trigger_get(adis->trig);
6464
if (ret)
6565
goto error_free_irq;
6666

0 commit comments

Comments
 (0)