* [PATCH] iio: imu: Use iio_trigger_get for indio_dev->trig assignment
@ 2015-03-28 6:37 Darshana Padmadas
2015-03-28 13:53 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Darshana Padmadas @ 2015-03-28 6:37 UTC (permalink / raw)
To: outreachy-kernel
Cc: jic23, linux-iio, srinivas.pandruvada, daniel.baluta,
Darshana Padmadas
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
Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
---
drivers/iio/imu/adis_trigger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index e0017c2..f53e9a8 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;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: imu: Use iio_trigger_get for indio_dev->trig assignment
2015-03-28 6:37 [PATCH] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Darshana Padmadas
@ 2015-03-28 13:53 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2015-03-28 13:53 UTC (permalink / raw)
To: Darshana Padmadas, outreachy-kernel
Cc: linux-iio, srinivas.pandruvada, daniel.baluta
On 28/03/15 06:37, Darshana Padmadas wrote:
> 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
>
> Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
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
> ---
> drivers/iio/imu/adis_trigger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
> index e0017c2..f53e9a8 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;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-28 13:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-28 6:37 [PATCH] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Darshana Padmadas
2015-03-28 13:53 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).