]> Gentwo Git Trees - linux/.git/commit
iio: adc: ad7173: fix using shared static info struct
authorDavid Lechner <dlechner@baylibre.com>
Wed, 27 Nov 2024 20:01:53 +0000 (14:01 -0600)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Dec 2024 17:23:42 +0000 (17:23 +0000)
commit36a44e05cd807a54e5ffad4b96d0d67f68ad8576
tree8803386e1b83d439e1a13515a3cd88b5e9492840
parent2a8e34096ec70d73ebb6d9920688ea312700cbd9
iio: adc: ad7173: fix using shared static info struct

Fix a possible race condition during driver probe in the ad7173 driver
due to using a shared static info struct. If more that one instance of
the driver is probed at the same time, some of the info could be
overwritten by the other instance, leading to incorrect operation.

To fix this, make the static info struct const so that it is read-only
and make a copy of the info struct for each instance of the driver that
can be modified.

Reported-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Fixes: 76a1e6a42802 ("iio: adc: ad7173: add AD7173 driver")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Tested-by: Guillaume Ranquet <granquet@baylibre.com>
Link: https://patch.msgid.link/20241127-iio-adc-ad7313-fix-non-const-info-struct-v2-1-b6d7022b7466@baylibre.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7173.c