mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
In the err_put_buffers cleanup path of iio_hw_consumer_alloc(), the code
was using list_for_each_entry() to iterate through buffers while calling
iio_buffer_put() which can free the current buffer if refcount drops to 0.
The list_for_each_entry() loop macro then evaluates buf->head.next to
continue iteration, accessing the freed buffer.
Fix this by using list_for_each_entry_safe().
Fixes: 48b66f8f93 ("iio: Add hardware consumer buffer support")
Reported-by: sashiko <[email protected]>
Closes: https://sashiko.dev/#/patchset/20260427-iio_buf-v1-1-2bbdac844647%40gmail.com
Signed-off-by: Felix Gu <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Reviewed-by: Maxwell Doose <[email protected]>
Cc: <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>