iio: imu: Use iio_trigger_get for indio_dev->trig assignment
PATCH 1/1 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.
This patch refers to a similar situation encountered through the following discussion:
http://www.spinics.net/lists/linux-iio/msg13669.html
--- drivers/iio/imu/adis_trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/adis_trigger.c +1 -1
@@ -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;
Signature · 1 line
1.9.1
Quoted 8 lines · Darshana Padmadas
This patch uses
iio_trigger_getto increment the reference count of trigger device, to avoid incorrect assignment.This patch refers to a similar situation encountered through the following discussion:
http://www.spinics.net/lists/linux-iio/msg13669.htmlSigned-off-by Darshana Padmadas <[email protected]>
Applied to the fixes-togreg branch of iio.git with it marked for stable as well.
Added a note that this can cause a null pointer dereference to make it clear why this should be in stable.
Thanks,
Jonathan
Quoted 18 lines
--- drivers/iio/imu/adis_trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/imu/adis_trigger.c +1
-1@@ -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;