]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
iio: buffer: Fix wait_queue not being removed
authorNuno Sá <nuno.sa@analog.com>
Mon, 16 Feb 2026 13:24:27 +0000 (13:24 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Feb 2026 08:24:39 +0000 (08:24 +0000)
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>
drivers/iio/industrialio-buffer.c

index f15a180dc49ea703ed280c534c2f2ed2fdddefbb..46f36a6ed2710ab611202734ed0f112789559770 100644 (file)
@@ -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)) {