All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Darshana Padmadas <darshanapadmadas@gmail.com>,
	outreachy-kernel@googlegroups.com
Cc: linux-iio@vger.kernel.org, srinivas.pandruvada@linux.intel.com,
	daniel.baluta@intel.com
Subject: Re: [PATCH] iio: imu: Use iio_trigger_get for indio_dev->trig assignment
Date: Sat, 28 Mar 2015 13:53:22 +0000	[thread overview]
Message-ID: <5516B252.6040104@kernel.org> (raw)
In-Reply-To: <1427524634-5677-1-git-send-email-darshanapadmadas@gmail.com>

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;
>  
> 


      reply	other threads:[~2015-03-28 13:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5516B252.6040104@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=darshanapadmadas@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.