mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
Input: rmi4 - fix memory leak in rmi_set_attn_data()
kfifo_put() returns 0 if the FIFO is full. In this case, we must
free the memory allocated for the attention data to avoid a leak.
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-5-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
6e752b35b6
commit
a55a683a8e
|
|
@ -183,7 +183,11 @@ void rmi_set_attn_data(struct rmi_device *rmi_dev, unsigned long irq_status,
|
|||
attn_data.size = size;
|
||||
attn_data.data = fifo_data;
|
||||
|
||||
kfifo_put(&drvdata->attn_fifo, attn_data);
|
||||
if (!kfifo_put(&drvdata->attn_fifo, attn_data)) {
|
||||
dev_warn_ratelimited(&rmi_dev->dev,
|
||||
"Failed to enqueue attention data, FIFO full\n");
|
||||
kfree(fifo_data);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rmi_set_attn_data);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user