Skip to content

Commit 0642340

Browse files
nunojsajic23
authored andcommitted
iio: buffer: Fix wait_queue not being removed
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: 9eeee3b ("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>
1 parent acc3949 commit 0642340

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/iio/industrialio-buffer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ static ssize_t iio_buffer_write(struct file *filp, const char __user *buf,
228228
written = 0;
229229
add_wait_queue(&rb->pollq, &wait);
230230
do {
231-
if (!indio_dev->info)
232-
return -ENODEV;
231+
if (!indio_dev->info) {
232+
ret = -ENODEV;
233+
break;
234+
}
233235

234236
if (!iio_buffer_space_available(rb)) {
235237
if (signal_pending(current)) {

0 commit comments

Comments
 (0)