Skip to content

Commit 7adaaee

Browse files
bvanasschedtor
authored andcommitted
Input: synaptics-rmi4 - fix a locking bug in an error path
Lock f54->data_mutex when entering the function statement since jumping to the 'error' label when checking report_size fails causes that mutex to be unlocked. This bug has been detected by the Clang thread-safety checker. Fixes: 3a762db ("[media] Input: synaptics-rmi4 - add support for F54 diagnostics") Signed-off-by: Bart Van Assche <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 5839419 commit 7adaaee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/input/rmi4/rmi_f54.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ static void rmi_f54_work(struct work_struct *work)
538538
int error;
539539
int i;
540540

541+
mutex_lock(&f54->data_mutex);
542+
541543
report_size = rmi_f54_get_report_size(f54);
542544
if (report_size == 0) {
543545
dev_err(&fn->dev, "Bad report size, report type=%d\n",
@@ -546,8 +548,6 @@ static void rmi_f54_work(struct work_struct *work)
546548
goto error; /* retry won't help */
547549
}
548550

549-
mutex_lock(&f54->data_mutex);
550-
551551
/*
552552
* Need to check if command has completed.
553553
* If not try again later.

0 commit comments

Comments
 (0)