From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BD5726FD9B; Thu, 25 Jun 2026 13:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782393090; cv=none; b=XwfBdKzT53hfj43WWWyEAf2FyKym6budjls5JU8ORZOuO1+2SAV7n/gdfM0tsVZo4CftKfUilUQnjbUZyK9bu+J9Cl3+FMJL2jqP962nJgxo002rNqMqF0NVnoVIPqAnXqEoY0AyHIbVOAkuLmsV2lBNbscRyHr2nk4IDbFO6iM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782393090; c=relaxed/simple; bh=I1s0gR4RW29iiNIi+lmCyMlOe3YsFtVCk89BnyI6sH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FjBEy+tmuYMrPvVYBU9NwcQjAFGfpZKdUFmTJ8anqczYzbfiyryFvGWmstqkp0INlIcakBaXgD/KqCBQuXxDcniFCfZAESZheN5y7jH5xgCo3uAWnwHy9iw6uz+n0aYNt6rkMnNWi3GPKk4ZKsbRlfDpYBsPGQIRPUK5K15tpJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f2ZgROO4; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f2ZgROO4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBE6E1F000E9; Thu, 25 Jun 2026 13:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1782393087; bh=Ds2Iu+gZ3tT1GW+ovSVM6yg0jQDS3od2JapdPLXZmi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f2ZgROO4aEa9jNmlA7WRVlWkUcOzOoo7nouguAeAa0fj2aDF3d5F3gjgEnb0flhzU nxp3YECuYXNZflA1K33lURv99RiAxWwPVoXTjOXoDI9lwq7G565rABH+0MH5zZh4AO e8TwDwHTw5qDazlRYvBBuq11vxBQ1EPtkknvZg8o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Torokhov Subject: [PATCH 7.0 40/49] Input: rmi4 - iterative IRQ handler Date: Thu, 25 Jun 2026 14:03:52 +0100 Message-ID: <20260625125643.147169358@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260625125637.527552689@linuxfoundation.org> References: <20260625125637.527552689@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov commit b6ca982afd0e8fbcbb340092d3c6d3b4a217686c upstream. 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: b908d3cd812a ("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 Signed-off-by: Greg Kroah-Hartman --- drivers/input/rmi4/rmi_driver.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -198,24 +198,24 @@ static irqreturn_t rmi_irq_fn(int irq, v 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; }