Chao Yu
3ba0ae8852
f2fs: fix to truncate preallocated blocks in f2fs_file_open()
...
[ Upstream commit 298b1e4182d657c3e388adcc29477904e9600ed5 ]
chenyuwen reports a f2fs bug as below:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000011
fscrypt_set_bio_crypt_ctx+0x78/0x1e8
f2fs_grab_read_bio+0x78/0x208
f2fs_submit_page_read+0x44/0x154
f2fs_get_read_data_page+0x288/0x5f4
f2fs_get_lock_data_page+0x60/0x190
truncate_partial_data_page+0x108/0x4fc
f2fs_do_truncate_blocks+0x344/0x5f0
f2fs_truncate_blocks+0x6c/0x134
f2fs_truncate+0xd8/0x200
f2fs_iget+0x20c/0x5ac
do_garbage_collect+0x5d0/0xf6c
f2fs_gc+0x22c/0x6a4
f2fs_disable_checkpoint+0xc8/0x310
f2fs_fill_super+0x14bc/0x1764
mount_bdev+0x1b4/0x21c
f2fs_mount+0x20/0x30
legacy_get_tree+0x50/0xbc
vfs_get_tree+0x5c/0x1b0
do_new_mount+0x298/0x4cc
path_mount+0x33c/0x5fc
__arm64_sys_mount+0xcc/0x15c
invoke_syscall+0x60/0x150
el0_svc_common+0xb8/0xf8
do_el0_svc+0x28/0xa0
el0_svc+0x24/0x84
el0t_64_sync_handler+0x88/0xec
It is because inode.i_crypt_info is not initialized during below path:
- mount
- f2fs_fill_super
- f2fs_disable_checkpoint
- f2fs_gc
- f2fs_iget
- f2fs_truncate
So, let's relocate truncation of preallocated blocks to f2fs_file_open(),
after fscrypt_file_open().
Fixes: d4dd19ec1ea0 ("f2fs: do not expose unwritten blocks to user by DIO")
Reported-by: chenyuwen <yuwen.chen@xjmz.com>
Closes: https://lore.kernel.org/linux-kernel/20240517085327.1188515-1-yuwen.chen@xjmz.com
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-03 09:00:58 +02:00
..
2024-05-29 09:25:15 -07:00
2024-03-12 20:32:19 -07:00
2024-02-26 11:36:28 +01:00
2024-07-02 21:23:00 +02:00
2024-01-11 20:11:35 -08:00
2024-07-11 20:10:55 -04:00
2024-03-12 20:32:19 -07:00
2024-03-12 20:32:19 -07:00
2024-08-03 09:00:31 +02:00
2024-07-05 18:40:40 +02:00
2024-05-25 14:23:58 -07:00
2024-03-12 20:32:19 -07:00
2024-05-03 02:36:51 -04:00
2024-05-19 09:21:03 -07:00
2024-05-28 14:32:42 +02:00
2023-12-28 04:57:57 -08:00
2024-04-23 16:08:55 -05:00
2024-05-13 14:14:05 -07:00
2024-04-13 10:33:02 +02:00
2024-02-27 11:21:33 +01:00
2024-08-03 09:00:45 +02:00
2024-08-03 09:00:30 +02:00
2024-01-23 10:58:56 -05:00
2024-08-03 09:00:34 +02:00
2024-08-03 09:00:37 +02:00
2024-08-03 09:00:58 +02:00
2024-04-25 21:07:02 -07:00
2024-03-26 09:04:53 +01:00
2024-08-03 09:00:32 +02:00
2024-05-21 09:51:42 -07:00
2024-08-03 09:00:34 +02:00
2024-08-03 08:59:11 +02:00
2024-08-03 09:00:45 +02:00
2024-03-12 20:32:19 -07:00
2024-05-19 09:21:03 -07:00
2024-06-05 17:27:03 +02:00
2024-05-09 18:09:57 +02:00
2024-08-03 09:00:40 +02:00
2024-05-25 13:23:42 -07:00
2024-07-27 11:40:32 +02:00
2024-05-04 19:02:39 +02:00
2024-05-06 09:07:20 -04:00
2024-07-10 07:15:36 +02:00
2024-07-11 09:03:28 -07:00
2024-08-03 09:00:05 +02:00
2024-08-03 09:00:32 +02:00
2024-08-03 09:00:47 +02:00
2024-05-20 12:43:58 -07:00
2024-08-03 09:00:45 +02:00
2024-07-27 11:40:32 +02:00
2024-03-26 09:04:54 +01:00
2024-05-14 17:44:14 -07:00
2024-06-14 10:30:40 +02:00
2024-08-03 09:00:34 +02:00
2024-03-09 12:33:22 -08:00
2024-03-12 20:32:19 -07:00
2024-03-26 09:04:53 +01:00
2024-04-12 14:52:29 +02:00
2024-04-25 20:56:25 -07:00
2024-05-21 08:34:51 -07:00
2024-03-27 13:17:15 +01:00
2024-08-03 09:00:36 +02:00
2024-05-19 14:02:03 -07:00
2024-04-23 13:27:43 +02:00
2024-02-27 11:21:31 +01:00
2024-05-23 09:31:50 -04:00
2024-03-21 15:09:29 -07:00
2024-08-03 09:00:36 +02:00
2024-03-12 20:32:19 -07:00
2024-05-10 04:34:52 +09:00
2024-04-03 16:06:39 +02:00
2024-05-03 08:30:58 -07:00
2024-06-26 14:29:25 +05:30
2024-04-10 07:23:47 +09:00
2024-05-21 13:11:44 -07:00
2024-04-26 10:33:05 +02:00
2024-03-12 20:03:34 -07:00
2024-05-02 20:35:57 +02:00
2024-04-24 15:55:28 -07:00
2024-05-19 14:02:03 -07:00
2023-10-30 19:28:19 -10:00
2024-05-21 09:51:42 -07:00
2023-11-02 20:53:31 -10:00
2024-05-23 12:04:36 -07:00
2024-04-25 20:56:20 -07:00
2024-07-11 09:03:28 -07:00
2024-04-11 10:21:24 +02:00
2024-02-08 10:12:26 +01:00
2024-05-05 14:00:48 -07:00
2024-05-19 09:21:03 -07:00
2024-05-10 08:26:31 +02:00
2024-04-05 15:53:47 +02:00
2024-03-12 20:03:34 -07:00
2024-05-30 09:11:47 +02:00
2024-02-02 13:11:50 +01:00
2024-04-05 15:53:45 +02:00
2024-03-15 09:00:09 -07:00
2024-05-02 20:35:57 +02:00
2024-05-13 06:58:35 +02:00
2024-03-14 17:43:30 -07:00
2024-04-17 13:49:44 +02:00
2024-07-27 11:40:36 +02:00
2024-03-11 10:21:06 -07:00
2024-02-27 11:21:31 +01:00
2024-02-08 10:12:37 +01:00
2023-11-18 14:56:16 +01:00
2024-02-06 14:31:05 +01:00
2024-06-18 16:26:09 +02:00
2024-02-07 21:16:29 +01:00
2024-03-13 12:53:53 -07:00
2024-07-01 09:22:08 -07:00
2024-05-21 08:08:00 -07:00
2024-02-02 13:11:49 +01:00
2023-11-18 14:56:16 +01:00
2024-03-12 20:03:34 -07:00
2023-11-18 14:56:16 +01:00
2024-05-21 13:11:44 -07:00
2023-12-12 16:20:02 +01:00
2024-04-15 14:54:13 -07:00
2024-02-20 09:23:52 +01:00
2024-05-02 16:28:20 +02:00
2024-05-24 13:34:07 +02:00
2024-04-15 16:03:25 -04:00
2024-03-26 09:01:18 +01:00
2024-06-18 16:20:47 +02:00
2023-12-28 04:57:57 -08:00
2024-04-10 16:23:02 -06:00
2024-07-03 22:40:36 -07:00
2024-02-15 23:43:47 -05:00