A potential race in drivers/iio/adc/vf610_adc.ko

From: Pavel Andrianov
Date: Fri Sep 02 2016 - 04:05:22 EST



Hi!

There is a potential race in drivers/iio/adc/vf610_adc.ko.
Handlers vf610_set_conversion_mode and vf610_write_raw are called via device_attibute interface, but they are related to different attributes, so may be executed in parallel. vf610_set_conversion_mode acquires the mutex indio_dev->mlock, and vf610_write_raw does not. Thus updating the structure 'info' may be performed simultaneously.

Should vf610_write_raw also acquire the same mutex indio_dev->mlock?

--
Pavel Andrianov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: andrianov@xxxxxxxxx