Commit 36a44e0
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 <[email protected]>
Fixes: 76a1e6a ("iio: adc: ad7173: add AD7173 driver")
Signed-off-by: David Lechner <[email protected]>
Tested-by: Guillaume Ranquet <[email protected]>
Link: https://patch.msgid.link/20241127-iio-adc-ad7313-fix-non-const-info-struct-v2-1-b6d7022b7466@baylibre.com
Cc: <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>1 parent 2a8e340 commit 36a44e0
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| |||
753 | 754 | | |
754 | 755 | | |
755 | 756 | | |
756 | | - | |
| 757 | + | |
757 | 758 | | |
758 | 759 | | |
759 | 760 | | |
| |||
1403 | 1404 | | |
1404 | 1405 | | |
1405 | 1406 | | |
1406 | | - | |
| 1407 | + | |
1407 | 1408 | | |
1408 | 1409 | | |
1409 | 1410 | | |
| |||
1436 | 1437 | | |
1437 | 1438 | | |
1438 | 1439 | | |
1439 | | - | |
1440 | | - | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1441 | 1443 | | |
1442 | 1444 | | |
1443 | 1445 | | |
| |||
0 commit comments