iio: imu: Use iio_trigger_get for indio_dev->trig assignment
authorDarshana Padmadas <darshanapadmadas@gmail.com>
Sat, 28 Mar 2015 06:37:14 +0000 (12:07 +0530)
committerSasha Levin <sasha.levin@oracle.com>
Fri, 24 Apr 2015 21:13:53 +0000 (17:13 -0400)
commitcfb769a843e50fd6d930a6655cdf2afd9bc0b0ab
tree79720f9f38b62bf2626753d4536b6060a922b84b
parentdcf72cd6133cd00f2cbdaf97a535187c222745c1
iio: imu: Use iio_trigger_get for indio_dev->trig assignment

[ Upstream commit 4ce7ca89d6e8eae9e201cd0e972ba323f33e2fb4 ]

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>
drivers/iio/imu/adis_trigger.c