]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: addac: stx104: Fix race condition for stx104_write_raw()
authorWilliam Breathitt Gray <william.gray@linaro.org>
Thu, 6 Apr 2023 14:40:10 +0000 (10:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 26 Aug 2023 12:23:27 +0000 (14:23 +0200)
commitd31d04ec404c4464c043ce1a61358d0eaad05eeb
treeb68d931fda52ff2d97cf7ee000b57a140628afa4
parent89a007f3a38359332136b48cf45a3d768fe76b1c
iio: addac: stx104: Fix race condition for stx104_write_raw()

[ Upstream commit 9740827468cea80c42db29e7171a50e99acf7328 ]

The priv->chan_out_states array and actual DAC value can become
mismatched if stx104_write_raw() is called concurrently. Prevent such a
race condition by utilizing a mutex.

Fixes: 97a445dad37a ("iio: Add IIO support for the DAC on the Apex Embedded Systems STX104")
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/c95c9a77fcef36b2a052282146950f23bbc1ebdc.1680790580.git.william.gray@linaro.org
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Stable-dep-of: 4f9b80aefb9e ("iio: addac: stx104: Fix race condition when converting analog-to-digital")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/addac/stx104.c