Skip to content

Commit a3d2f88

Browse files
xNombreonettboots
authored andcommitted
input: goodix: Fix wrongly placed mutex unlock
Xiaomeme added a condition that can keep on iteration over modules however left mutex unlock before it. This can cause premature mutex unlock and double-unlock afterwards which leads to undefined behavior. Mutex unlock should be called only when taking out path. Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com> Signed-off-by: onettboots <blackcocopet@gmail.com>
1 parent 9d57ea6 commit a3d2f88

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/input/touchscreen/goodix_driver_gt9886/goodix_ts_core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,13 +1757,14 @@ int goodix_ts_suspend(struct goodix_ts_core *core_data)
17571757
} else if (core_data->udfps_enabled) {
17581758
atomic_set(&core_data->suspend_stat, TP_GESTURE_FOD);
17591759
}
1760-
mutex_unlock(&goodix_modules.mutex);
17611760
ts_info("suspend_stat[%d]", atomic_read(&core_data->suspend_stat));
17621761
ts_info("Canceled by module:%s", ext_module->name);
1763-
if (!atomic_read(&core_data->suspend_stat))
1762+
if (!atomic_read(&core_data->suspend_stat)) {
17641763
ts_info("go suspend remaind work\n");
1765-
else
1764+
} else {
1765+
mutex_unlock(&goodix_modules.mutex);
17661766
goto out;
1767+
}
17671768
}
17681769
}
17691770
}

0 commit comments

Comments
 (0)