summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Sá <nuno.sa@analog.com>2026-02-16 13:24:27 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-03-19 16:08:47 +0100
commitc7ae426705b0102338957b3648229a1b32a4eb9a (patch)
tree24726fc352b22cb6b03c22881dc938b595e22a73
parentc528dc22d58b714e50ebe8d656a0d7350743d219 (diff)
iio: buffer: Fix wait_queue not being removed
commit 064234044056c93a3719d6893e6e5a26a94a61b6 upstream. 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> Reviewed-by: David Lechner <dlechner@baylibre.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/iio/industrialio-buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 96ea0f039dfb..c46a5f37ccc9 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)) {