mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
Input: rmi4 - iterative IRQ handler
The current IRQ handler uses recursion to drain the attention FIFO,
which can lead to stack overflow on deep queues. Convert it to a
loop.
Fixes: b908d3cd81 ("Input: synaptics-rmi4 - allow to add attention data")
Cc: stable@vger.kernel.org
Assisted-by: Gemini:gemini-3.1-pro
Link: https://patch.msgid.link/20260505045952.1570713-6-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
@@ -198,24 +198,24 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
|
||||
struct rmi4_attn_data attn_data = {0};
|
||||
int ret, count;
|
||||
|
||||
count = kfifo_get(&drvdata->attn_fifo, &attn_data);
|
||||
if (count) {
|
||||
*(drvdata->irq_status) = attn_data.irq_status;
|
||||
drvdata->attn_data = attn_data;
|
||||
}
|
||||
do {
|
||||
count = kfifo_get(&drvdata->attn_fifo, &attn_data);
|
||||
if (count) {
|
||||
*drvdata->irq_status = attn_data.irq_status;
|
||||
drvdata->attn_data = attn_data;
|
||||
}
|
||||
|
||||
ret = rmi_process_interrupt_requests(rmi_dev);
|
||||
if (ret)
|
||||
rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
|
||||
"Failed to process interrupt request: %d\n", ret);
|
||||
ret = rmi_process_interrupt_requests(rmi_dev);
|
||||
if (ret)
|
||||
rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev,
|
||||
"Failed to process interrupt request: %d\n",
|
||||
ret);
|
||||
|
||||
if (count) {
|
||||
kfree(attn_data.data);
|
||||
drvdata->attn_data.data = NULL;
|
||||
}
|
||||
|
||||
if (!kfifo_is_empty(&drvdata->attn_fifo))
|
||||
return rmi_irq_fn(irq, dev_id);
|
||||
if (count) {
|
||||
kfree(attn_data.data);
|
||||
drvdata->attn_data.data = NULL;
|
||||
}
|
||||
} while (!kfifo_is_empty(&drvdata->attn_fifo));
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user