public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: buffer: Fix wait_queue not being removed
@ 2026-02-16 13:24 Nuno Sá via B4 Relay
  2026-02-21 21:27 ` David Lechner
  0 siblings, 1 reply; 6+ messages in thread
From: Nuno Sá via B4 Relay @ 2026-02-16 13:24 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Andy Shevchenko

From: Nuno Sá <nuno.sa@analog.com>

In the edge case where the IIO device is unregistered while we're
buffering, we were directly returning an error without removing the wait
queue. Instead, set 'ret' and break out of the loop.

Fixes: 9eeee3b0bf19 ("iio: Add output buffer support")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/iio/industrialio-buffer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index c6259213e150..a09c0d263d7f 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -228,8 +228,10 @@ static ssize_t iio_buffer_write(struct file *filp, const char __user *buf,
 	written = 0;
 	add_wait_queue(&rb->pollq, &wait);
 	do {
-		if (!indio_dev->info)
-			return -ENODEV;
+		if (!indio_dev->info) {
+			ret = -ENODEV;
+			break;
+		}
 
 		if (!iio_buffer_space_available(rb)) {
 			if (signal_pending(current)) {

---
base-commit: f52690c50893ef1504990199c8a2dfbb869f38c6
change-id: 20260216-iio-buffer-write-fix-31ddf8b2a4a0
--

Thanks!
- Nuno Sá



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

end of thread, other threads:[~2026-02-23 17:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16 13:24 [PATCH] iio: buffer: Fix wait_queue not being removed Nuno Sá via B4 Relay
2026-02-21 21:27 ` David Lechner
2026-02-22 12:37   ` Jonathan Cameron
2026-02-23 13:39     ` Nuno Sá
2026-02-23 15:05       ` Andy Shevchenko
2026-02-23 17:08         ` Nuno Sá

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