Linux IIO development
 help / color / mirror / Atom feed
* [PATCH -next] iio: core: fix missing mutex_unlock() in iio_device_claim_buffer_mode()
@ 2022-11-04  9:03 Peng Wu
  2022-11-04  9:54 ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Wu @ 2022-11-04  9:03 UTC (permalink / raw)
  To: jic23, lars, nuno.sa, andy.shevchenko; +Cc: linux-iio, liwei391, Peng Wu

In the success path of iio_device_claim_buffer_mode(), mutex_unlock()
should be called before return.

Fixes: e6dad5edfb8c ("iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 drivers/iio/industrialio-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 52e690f031cb..88987cdc9e3f 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -2102,8 +2102,10 @@ int iio_device_claim_buffer_mode(struct iio_dev *indio_dev)
 
 	mutex_lock(&iio_dev_opaque->mlock);
 
-	if (iio_buffer_enabled(indio_dev))
+	if (iio_buffer_enabled(indio_dev)) {
+		mutex_unlock(&iio_dev_opaque->mlock);
 		return 0;
+	}
 
 	mutex_unlock(&iio_dev_opaque->mlock);
 	return -EBUSY;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-04 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04  9:03 [PATCH -next] iio: core: fix missing mutex_unlock() in iio_device_claim_buffer_mode() Peng Wu
2022-11-04  9:54 ` Andy Shevchenko
2022-11-04 11:13   ` Nuno Sá
2022-11-04 12:52     ` Andy Shevchenko
2022-11-04 13:38       ` Nuno Sá

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox