Ryusuke Konishi 0b4816d267 nilfs2: protect access to buffers with no active references
nilfs_lookup_dirty_data_buffers(), which iterates through the buffers
attached to dirty data folios/pages, accesses the attached buffers without
locking the folios/pages.

For data cache, nilfs_clear_folio_dirty() may be called asynchronously
when the file system degenerates to read only, so
nilfs_lookup_dirty_data_buffers() still has the potential to cause use
after free issues when buffers lose the protection of their dirty state
midway due to this asynchronous clearing and are unintentionally freed by
try_to_free_buffers().

Eliminate this race issue by adjusting the lock section in this function.

Link: https://lkml.kernel.org/r/20250107200202.6432-3-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption")
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-01-11 23:20:45 -08:00
..
2024-11-01 07:37:10 -10:00
2024-12-29 09:34:34 -08:00
2024-07-15 11:14:59 -07:00
2024-11-26 13:39:02 -08:00
2024-11-25 17:08:27 +09:00
2024-09-16 09:14:02 +02:00
2024-11-26 12:50:58 -08:00
2024-10-17 00:28:06 -07:00
2024-11-27 13:11:58 -08:00
2024-11-26 12:34:50 -08:00
2024-11-18 09:35:30 -08:00
2024-11-26 18:15:06 +01:00
2024-12-05 12:31:40 +01:00
2024-11-26 12:59:30 -08:00
2024-12-23 12:16:15 -08:00
\n
2024-11-21 09:55:45 -08:00
2024-11-22 20:55:42 -08:00
2024-05-28 11:52:53 +02:00
2024-08-21 22:32:58 +02:00
2024-10-02 12:02:15 -07:00
2024-11-03 01:28:06 -05:00
2024-11-21 08:28:08 -08:00
2024-11-26 13:26:15 -08:00
2024-11-18 10:30:29 -08:00
2024-11-18 10:45:06 -08:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-10-21 16:29:38 +02:00
2024-11-03 01:28:06 -05:00
2024-10-21 16:29:38 +02:00
2024-09-24 15:29:42 -07:00
2024-09-16 11:15:26 +02:00
2024-09-27 08:18:43 -07:00
\n
2024-11-21 09:55:45 -08:00
2024-10-24 13:54:51 +02:00
2024-09-27 08:18:43 -07:00
2024-11-03 01:28:07 -05:00
2024-11-03 01:28:07 -05:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00