xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf
Impact
In the Linux kernel, the following vulnerability has been resolved:
Source excerpt · LinuxAffected packages
Affected products
Vendor version evidence. Product records are separate from automatic dependency matching.
Linux · Linux
Other versions: unaffected
| Version / range | Source status |
|---|---|
| f7664b31975bd893190708e76b2c424328f0c49b to before e5456dec79c71c8ef8f9f9adb77d320f113b34db | affected |
| f7664b31975bd893190708e76b2c424328f0c49b to before 6353e5cd8c43d6e805cacbfbfecf4103571a7ff8 | affected |
| f7664b31975bd893190708e76b2c424328f0c49b to before 41a28c865d1d5843f8cb9e0af17a8f4d9e2961ff | affected |
Linux · Linux
Other versions: affected
| Version / range | Source status |
|---|---|
| 4.18 | affected |
| 0 to before 4.18 | unaffected |
| 6.18.59 through 6.18.* (inclusive) | unaffected |
| 7.2.13 through 7.2.* (inclusive) | unaffected |
| 7.3 through * (inclusive) | unaffected |
Original source description
In the Linux kernel, the following vulnerability has been resolved:
xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf
xfs_sync_sb_buf() holds sb/rtsb buffer locks across a synchronous xfs_trans_commit(), which flushes the CIL push workqueue internally. If shutdown occurs during the CIL push, xfs_buf_item_unpin() needs to lock these buffers to fail them, causing a deadlock:
setlabel: holds buf lock -> flush_workqueue(xfs-cil) CIL push worker: xfs_buf_item_unpin -> xfs_buf_lock(same buf)
Remove the xfs_trans_bhold() calls so that commit releases the buffer locks normally. After the sync commit, re-acquire the buffers via mp->m_sb_bp / mp->m_rtsb_bp for the on-disk writeback.