Re: [PATCH 15/62] Input: synaptics-rmi4 - fix a locking bug in an error path
From: Bart Van Assche
Date: Mon Feb 23 2026 - 17:20:19 EST
On 2/23/26 1:58 PM, Dmitry Torokhov wrote:
Hi Bart,
On Mon, Feb 23, 2026 at 01:50:30PM -0800, Bart Van Assche wrote:
Lock f54->data_mutex before the first 'goto error' statement since
jumping to the 'error' label causes that mutex to be unlocked.
This bug has been detected by the Clang thread-safety checker.
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Cc: Nick Dyer <nick@xxxxxxxxxxxxx>
Cc: linux-input@xxxxxxxxxxxxxxx
Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
drivers/input/rmi4/rmi_f54.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index ac4041a69fcd..fd57ebb1cb50 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -539,6 +539,9 @@ static void rmi_f54_work(struct work_struct *work)
int i;
report_size = rmi_f54_get_report_size(f54);
+
+ mutex_lock(&f54->data_mutex);
+
Thank you for the patch. Do you mind if I move mutex_lock() above the
call to rmi_f54_get_report_size()? It does not extend critical section
by much, and I think logically makes more sense.
That sounds good to me. Please keep in mind that I'm not familiar with
the rmi4 driver.
Thanks,
Bart.