5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Karl Mehltretter commit dff701806ab6252f6a0fccba880c47cd09602625 upstream. iio_trigger_attach_poll_func() prints an error when all CONFIG_IIO_CONSUMERS_PER_TRIGGER irqs of the trigger are in use, but returns 0. The buffer of the extra consumer is enabled without a poll function. Disabling that buffer calls clear_bit() with a negative bit number and drops a module reference for the second time. On arm and arm64 the clear_bit() goes about 512 MB past the pool bitmap. That is an oops if the address is not mapped, and a bit cleared in unrelated memory if it is. Return the error from iio_trigger_get_irq(). Fixes: 995438233579 ("iio: Fix error handling in iio_trigger_attach_poll_func") Cc: stable@vger.kernel.org Signed-off-by: Karl Mehltretter Reviewed-by: Joshua Crofts Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/industrialio-trigger.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -254,6 +254,7 @@ int iio_trigger_attach_poll_func(struct if (pf->irq < 0) { pr_err("Could not find an available irq for trigger %s, CONFIG_IIO_CONSUMERS_PER_TRIGGER=%d limit might be exceeded\n", trig->name, CONFIG_IIO_CONSUMERS_PER_TRIGGER); + ret = pf->irq; goto out_put_module; }