MAX86902 Sensor Driver Race Condition Vulnerability
The MAX86902 sensor has a driver that exposes several interfaces through which the device may be configured. In addition to exposing a character device, it also exposes several entries under sysfs. Some of these entries are writable, allowing different values to be configured. Three such files are exposed under the paths: /sys/devices/virtual/sensors/hrm_sensor/eol_test_result, /sys/devices/virtual/sensors/hrm_sensor/lib_ver, /sys/devices/virtual/sensors/uv_sensor/uv_lib_ver. The sysfs write handlers for these files all share approximately the same logic. Since the code does not use any mechanism to prevent concurrent access, it contains race conditions which allow corruption of kernel memory. For example, one such race condition could occur when two attempts to call 'write' are executed at the same time, where the underlying buffers have different lengths.