[3.5.y.z extended stable] Patch "iio:accel:kxsd9 fix missing mutex unlock" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Thu Dec 5 10:29:13 UTC 2013


This is a note to let you know that I have just added a patch titled

    iio:accel:kxsd9 fix missing mutex unlock

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From 0e7314af3b0ceb20225b7476bcceeff69efd78a3 Mon Sep 17 00:00:00 2001
From: Frank Zago <frank at zago.net>
Date: Wed, 13 Nov 2013 22:53:00 +0000
Subject: iio:accel:kxsd9 fix missing mutex unlock

commit 0ee005c7dc2803125275e24598f0fb37775a6af3 upstream.

This will leave a lock held after reading from the device, preventing
any further reads.

Signed-off-by: Frank Zago <frank at zago.net>
Signed-off-by: Jonathan Cameron <jic23 at kernel.org>
[ luis: backported to 3.5:
  - adjusted context
  - drivers/iio/accel/kxsd9.c -> drivers/staging/iio/accel/kxsd9.c ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 drivers/staging/iio/accel/kxsd9.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/kxsd9.c b/drivers/staging/iio/accel/kxsd9.c
index 8cf7cd9..cfa77fb 100644
--- a/drivers/staging/iio/accel/kxsd9.c
+++ b/drivers/staging/iio/accel/kxsd9.c
@@ -116,9 +116,10 @@ static int kxsd9_read(struct iio_dev *indio_dev, u8 address)
 	spi_message_add_tail(&xfers[0], &msg);
 	spi_message_add_tail(&xfers[1], &msg);
 	ret = spi_sync(st->us, &msg);
-	if (ret)
-		return ret;
-	return (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0);
+	if (!ret)
+		ret = (((u16)(st->rx[0])) << 8) | (st->rx[1] & 0xF0);
+	mutex_unlock(&st->buf_lock);
+	return ret;
 }

 static IIO_CONST_ATTR(accel_scale_available,
--
1.8.3.2





More information about the kernel-team mailing list