Commit 5459e18
committed
cxl/port: Fix missing target list lock
cxl_port_setup_targets() modifies the ->targets[] array of a switch
decoder. target_list_show() expects to be able to emit a coherent
snapshot of that array by "holding" ->target_lock for read. The
target_lock is held for write during initialization of the ->targets[]
array, but it is not held for write during cxl_port_setup_targets().
The ->target_lock() predates the introduction of @cxl_region_rwsem. That
semaphore protects changes to host-physical-address (HPA) decode which
is precisely what writes to a switch decoder's target list affects.
Replace ->target_lock with @cxl_region_rwsem.
Now the side-effect of snapshotting a unstable view of a decoder's
target list is likely benign so the Fixes: tag is presumptive.
Fixes: 27b3f8d ("cxl/region: Program target lists")
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>1 parent d6488fe commit 5459e18
2 files changed
Lines changed: 7 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | 175 | | |
177 | 176 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
| 177 | + | |
| 178 | + | |
183 | 179 | | |
184 | 180 | | |
185 | 181 | | |
| |||
1633 | 1629 | | |
1634 | 1630 | | |
1635 | 1631 | | |
1636 | | - | |
| 1632 | + | |
1637 | 1633 | | |
1638 | 1634 | | |
1639 | 1635 | | |
| |||
1643 | 1639 | | |
1644 | 1640 | | |
1645 | 1641 | | |
1646 | | - | |
| 1642 | + | |
1647 | 1643 | | |
1648 | 1644 | | |
1649 | 1645 | | |
1650 | | - | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
| 1646 | + | |
| 1647 | + | |
1654 | 1648 | | |
1655 | 1649 | | |
1656 | | - | |
1657 | 1650 | | |
1658 | | - | |
| 1651 | + | |
1659 | 1652 | | |
1660 | 1653 | | |
1661 | 1654 | | |
| |||
1725 | 1718 | | |
1726 | 1719 | | |
1727 | 1720 | | |
1728 | | - | |
1729 | 1721 | | |
1730 | 1722 | | |
1731 | 1723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
416 | 415 | | |
417 | 416 | | |
418 | 417 | | |
| |||
424 | 423 | | |
425 | 424 | | |
426 | 425 | | |
427 | | - | |
428 | 426 | | |
429 | 427 | | |
430 | 428 | | |
| |||
0 commit comments