Commit 01657bc
iommu: Avoid races around device probe
We currently have 3 different ways that __iommu_probe_device() may be
called, but no real guarantee that multiple callers can't tread on each
other, especially once asynchronous driver probe gets involved. It would
likely have taken a fair bit of luck to hit this previously, but commit
57365a0 ("iommu: Move bus setup to IOMMU device registration") ups
the odds since now it's not just omap-iommu that may trigger multiple
bus_iommu_probe() calls in parallel if probing asynchronously.
Add a lock to ensure we can't try to double-probe a device, and also
close some possible race windows to make sure we're truly robust against
trying to double-initialise a group via two different member devices.
Reported-by: Brian Norris <[email protected]>
Signed-off-by: Robin Murphy <[email protected]>
Tested-by: Brian Norris <[email protected]>
Fixes: 57365a0 ("iommu: Move bus setup to IOMMU device registration")
Link: https://lore.kernel.org/r/1946ef9f774851732eed78760a78ec40dbc6d178.1667591503.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <[email protected]>1 parent 69e61ed commit 01657bc
1 file changed
+22
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| 309 | + | |
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
313 | | - | |
314 | | - | |
315 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
316 | 326 | | |
317 | 327 | | |
318 | 328 | | |
| |||
333 | 343 | | |
334 | 344 | | |
335 | 345 | | |
336 | | - | |
337 | 346 | | |
| 347 | + | |
338 | 348 | | |
339 | 349 | | |
| 350 | + | |
| 351 | + | |
340 | 352 | | |
| 353 | + | |
341 | 354 | | |
342 | 355 | | |
343 | 356 | | |
| |||
352 | 365 | | |
353 | 366 | | |
354 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
355 | 371 | | |
356 | 372 | | |
357 | 373 | | |
| |||
1824 | 1840 | | |
1825 | 1841 | | |
1826 | 1842 | | |
| 1843 | + | |
| 1844 | + | |
1827 | 1845 | | |
1828 | 1846 | | |
1829 | 1847 | | |
1830 | | - | |
1831 | | - | |
1832 | 1848 | | |
1833 | 1849 | | |
1834 | 1850 | | |
| |||
0 commit comments