diff options
| author | Chris Mason <mason@kernel.org> | 2026-11-12 16:46:16 -0500 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-11-16 11:45:49 +0100 |
| commit | 03cbbd80a3e7070e8ab63996a94a7815722c2578 (patch) | |
| tree | c66e0c5f6c259675298e3c443b0077f3abec399c /rust/kernel/alloc | |
| parent | 230565493938cc0284116ff3795eb5343781eb97 (diff) | |
xfs: restart faults racing with realtime flag changes
On a zoned XFS, a store through a shared mapping can dereference a NULL
pointer if the realtime flag of the file is set as the write fault
starts.
xfs_write_fault() reserves zoned space only for a zoned inode. The
reservation can wait for garbage collection, which takes the MMAPLOCK,
so it comes ahead of that lock, and so does the test for a zoned inode.
FS_IOC_FSSETXATTR can set the flag of a file with no blocks right after
the test:
write fault FS_IOC_FSSETXATTR
=========== =================
xfs_write_fault()
sees that the inode is not zoned
sets the realtime flag
takes the MMAPLOCK
xfs_buffered_write_iomap_begin()
sees that the inode is zoned
/* ac is NULL */
The fix used here is to test again under the MMAPLOCK, which keeps the
ioctl out since "xfs: take the MMAPLOCK in xfs_fileattr_set()", and to
start the fault over if the flag has changed.
Fixes: 058dd70c65ab ("xfs: implement buffered writes to zoned RT devices")
Signed-off-by: Chris Mason <mason@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
