btrfs: lock the inode in shared mode before starting fiemap
CVE-2023-52737
What is CVE-2023-52737?
A vulnerability in the Linux kernel's btrfs file system has been identified that can result in deadlock situations. This occurs because the fiemap operation fails to acquire the inode's lock. Instead, it only locks a file range in the inode's IO tree, potentially leading to blocking scenarios when concurrent fsync operations are executed. The conflict arises from the inode's i_mmap_lock semaphore, which is utilized by both fsync and the btrfs_page_mkwrite() function. If a fault occurs while accessing user space buffers during fiemap, it can lead to prolonged blocking of tasks, affecting overall system functionality and potentially leading to data loss or corruption.
Affected Version(s)
Linux 885f46d87f29a94eafe3cc707d5c4dea2be248f3
Linux 885f46d87f29a94eafe3cc707d5c4dea2be248f3
Linux 885f46d87f29a94eafe3cc707d5c4dea2be248f3 < 519b7e13b5ae8dd38da1e52275705343be6bb508