Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1401114
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request |
| Date | 2016-05-14 19:00 +0200 |
| Message-ID | <ryL50-4eO-9@gated-at.bofh.it> (permalink) |
| References | <ryqjU-Jw-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 13/05/16 19:43, Crestez Dan Leonard wrote:
> This fixes a possible race where an interrupt arrives before complete
> initialization and crashes because iio_trigger_get_drvdata returns NULL.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Giuseppe Barba <giuseppe.barba@st.com>
> Cc: Denis Ciocca <denis.ciocca@st.com>
> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Looks 'obviously' correct to me, but I'd like Denis to confirm on this one.
Jonathan
> ---
> I ran into this while breaking the driver. But since the interrupt line can be
> shared the handler should always be able to accept and ignore a call.
>
> drivers/iio/common/st_sensors/st_sensors_trigger.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
> index 98bd5b3..7c2e6ab 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
> @@ -89,6 +89,10 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
> return -ENOMEM;
> }
>
> + iio_trigger_set_drvdata(sdata->trig, indio_dev);
> + sdata->trig->ops = trigger_ops;
> + sdata->trig->dev.parent = sdata->dev;
> +
> irq = sdata->get_irq_data_ready(indio_dev);
> irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq));
> /*
> @@ -150,10 +154,6 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
> goto iio_trigger_free;
> }
>
> - iio_trigger_set_drvdata(sdata->trig, indio_dev);
> - sdata->trig->ops = trigger_ops;
> - sdata->trig->dev.parent = sdata->dev;
> -
> err = iio_trigger_register(sdata->trig);
> if (err < 0) {
> dev_err(&indio_dev->dev, "failed to register iio trigger.\n");
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/3] iio: st_sensors: Init trigger before irq request Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-13 20:50 +0200
[PATCH 3/3] iio: st_sensors: Use level interrupts Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-13 20:50 +0200
Re: [PATCH 3/3] iio: st_sensors: Use level interrupts Jonathan Cameron <jic23@kernel.org> - 2016-05-14 18:20 +0200
Re: [PATCH 3/3] iio: st_sensors: Use level interrupts Linus Walleij <linus.walleij@linaro.org> - 2016-05-24 13:50 +0200
Re: [PATCH 3/3] iio: st_sensors: Use level interrupts Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-24 14:40 +0200
Re: [PATCH 3/3] iio: st_sensors: Use level interrupts Jonathan Cameron <jic23@kernel.org> - 2016-05-29 21:30 +0200
[PATCH 2/3] iio: st_sensors: Disable DRDY at init time Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-13 20:50 +0200
Re: [PATCH 2/3] iio: st_sensors: Disable DRDY at init time Jonathan Cameron <jic23@kernel.org> - 2016-05-14 19:00 +0200
Re: [PATCH 2/3] iio: st_sensors: Disable DRDY at init time Linus Walleij <linus.walleij@linaro.org> - 2016-05-24 13:30 +0200
Re: [PATCH 2/3] iio: st_sensors: Disable DRDY at init time Jonathan Cameron <jic23@kernel.org> - 2016-05-29 21:30 +0200
Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request Jonathan Cameron <jic23@kernel.org> - 2016-05-14 19:00 +0200
Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request Linus Walleij <linus.walleij@linaro.org> - 2016-05-24 13:30 +0200
Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request Crestez Dan Leonard <leonard.crestez@intel.com> - 2016-05-24 14:40 +0200
Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request Linus Walleij <linus.walleij@linaro.org> - 2016-05-25 00:00 +0200
Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request Jonathan Cameron <jic23@kernel.org> - 2016-05-29 21:30 +0200
csiph-web