]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: addac: stx104: Fix race condition when converting analog-to-digital
authorWilliam Breathitt Gray <william.gray@linaro.org>
Thu, 6 Apr 2023 14:40:11 +0000 (10:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Aug 2023 12:23:27 +0000 (14:23 +0200)
commit9fa82f031af8d30431ee0ce92ecae477be66585c
treeec35e550c7b60f7d6801947c9f59d8cc40533690
parentd31d04ec404c4464c043ce1a61358d0eaad05eeb
iio: addac: stx104: Fix race condition when converting analog-to-digital

[ Upstream commit 4f9b80aefb9e2f542a49d9ec087cf5919730e1dd ]

The ADC conversion procedure requires several device I/O operations
performed in a particular sequence. If stx104_read_raw() is called
concurrently, the ADC conversion procedure could be clobbered. Prevent
such a race condition by utilizing a mutex.

Fixes: 4075a283ae83 ("iio: stx104: Add IIO support for the ADC channels")
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/2ae5e40eed5006ca735e4c12181a9ff5ced65547.1680790580.git.william.gray@linaro.org
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/addac/stx104.c