From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Josef Bacik" <josef@toxicpanda.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
stable <stable@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Leonard Crestez" <cdleonard@gmail.com>
Subject: [PATCH 02/15] iio: trigger: fail the attach if no sub-IRQ is left
Date: Tue, 27 Oct 2026 17:19:06 +0100 [thread overview]
Message-ID: <20261027-llm-char-misc-iio-v1-2-0d818334f6c7@linuxfoundation.org> (raw)
In-Reply-To: <20261027-llm-char-misc-iio-v1-0-0d818334f6c7@linuxfoundation.org>
From: Josef Bacik <josef@toxicpanda.com>
A trigger can serve CONFIG_IIO_CONSUMERS_PER_TRIGGER devices, two by
default. When one more device is attached, iio_trigger_get_irq() returns
-ENOMEM. iio_trigger_attach_poll_func() prints an error, drops the module
reference and jumps to its exit, but ret is still 0 there, so it reports
success.
iio_enable_buffers() goes on as if the poll function were attached. The
write to buffer/enable succeeds, but no sample ever arrives. When the
buffer is disabled again, iio_trigger_detach_poll_func() undoes an attach
which has not taken place, with -ENOMEM in pf->irq:
- iio_trigger_put_irq() calls clear_bit() with the bit number
-ENOMEM - trig->subirq_base, which clears a bit in whatever lies in
front of trig->pool;
- if only one of the real consumers is left, the trigger is switched off
under it;
- module_put() drops a reference to the driver module which has been
dropped already.
All it takes is to set the same trigger as current_trigger of three
devices and to enable their buffers.
Return the error.
Fixes: 995438233579 ("iio: Fix error handling in iio_trigger_attach_poll_func")
Cc: stable <stable@kernel.org>
Cc: David Lechner <dlechner@baylibre.com>
Cc: "Nuno Sá" <nuno.sa@analog.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: Leonard Crestez <cdleonard@gmail.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/industrialio-trigger.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 76926fee0f84..fc4651490d42 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -293,6 +293,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
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;
}
--
2.56.0
next prev parent reply other threads:[~2026-10-27 16:19 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 16:19 [PATCH 00/15] IIO: a bunch of llm-found fixes Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 01/15] iio: buffer: let the block keep its DMA fence Greg Kroah-Hartman
2026-10-28 9:30 ` Nuno Sá
2026-10-27 16:19 ` Greg Kroah-Hartman [this message]
2026-10-28 9:38 ` [PATCH 02/15] iio: trigger: fail the attach if no sub-IRQ is left Nuno Sá
2026-10-27 16:19 ` [PATCH 03/15] iio: accel: adxl367: don't stay in standby on -EINVAL Greg Kroah-Hartman
2026-10-28 10:01 ` Nuno Sá
2026-10-27 16:19 ` [PATCH 04/15] iio: accel: adxl380: " Greg Kroah-Hartman
2026-10-28 10:02 ` Nuno Sá
2026-10-27 16:19 ` [PATCH 05/15] iio: adc: check the result of ad_sd_init() Greg Kroah-Hartman
2026-10-28 9:40 ` Nuno Sá
2026-10-27 16:19 ` [PATCH 06/15] iio: adc: ad7923: add the AD7927 to the SPI ID table Greg Kroah-Hartman
2026-10-28 9:35 ` Nuno Sá
2026-10-27 16:19 ` [PATCH 07/15] iio: addac: ad74413r: fix the values of set_multiple Greg Kroah-Hartman
2026-10-28 9:38 ` Nuno Sá
2026-10-27 16:19 ` [PATCH 08/15] iio: light: apds9306: push events to the IIO device Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 09/15] iio: light: tsl2591: don't divide by zero in the dark Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 10/15] iio: light: tsl2591: don't divide by zero with low gain Greg Kroah-Hartman
2026-10-28 2:13 ` Jonathan Cameron
2026-10-28 4:16 ` Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 11/15] iio: hid-sensors: fix a division by zero Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 12/15] iio: imu: inv_mpu6050: don't disable the IRQ under lock Greg Kroah-Hartman
2026-10-27 16:19 ` [PATCH 13/15] iio: proximity: sx9500: hand on probe deferral of GPIOs Greg Kroah-Hartman
2026-10-28 2:09 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 14/15] iio: scmi: use 64-bit divisions for rates and intervals Greg Kroah-Hartman
2026-10-28 1:46 ` Jonathan Cameron
2026-10-27 16:19 ` [PATCH 15/15] iio: sx9310: use the data of the I2C table Greg Kroah-Hartman
2026-10-27 16:25 ` Biju Das
2026-10-27 16:38 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261027-llm-char-misc-iio-v1-2-0d818334f6c7@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=andy@kernel.org \
--cc=cdleonard@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®