[lvc-project] [PATCH] udf: Check return code from udf_update_extents
Ефанов Владислав Александрович
vefanov at ispras.ru
Tue Jan 24 19:42:07 MSK 2023
Thank you for information.
Vlad.
On 24.01.2023 11:47, Jan Kara wrote:
> On Fri 20-01-23 12:10:28, Vladislav Efanov wrote:
>> udf_add_aext() does not create new extent and returns ENOSPC if new
>> block was not created by udf_bitmap_new_block(). The caller,
>> udf_insert_aext(), does not check this return code and returns OK to
>> its caller(udf_update_extents). Finally the error is being lost. So
>> an inconsistency in inode.i_size and extents length becomes.
>>
>> Later this inconsistency leads to WARNING:
>>
>> WARNING: CPU: 3 PID: 1104 at fs/udf/truncate.c:226
>> udf_truncate_extents+0x7e0/0x8e0 fs/udf/truncate.c:226
>>
>> RIP: 0010:udf_truncate_extents+0x7e0/0x8e0 fs/udf/truncate.c:226
>> Call Trace:
>> udf_write_failed.isra.0+0x173/0x1c0 fs/udf/inode.c:179
>> udf_write_begin+0x8d/0xb0 fs/udf/inode.c:214
>> generic_perform_write+0x20a/0x4e0 mm/filemap.c:3333
>> __generic_file_write_iter+0x252/0x610 mm/filemap.c:3462
>> udf_file_write_iter+0x2cc/0x4e0 fs/udf/file.c:168
>> call_write_iter include/linux/fs.h:1904 [inline]
>> new_sync_write+0x42c/0x660 fs/read_write.c:518
>> vfs_write+0x75b/0xa40 fs/read_write.c:605
>>
>> Found by Linux Verification Center (linuxtesting.org) with syzkaller.
>>
>> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>> Signed-off-by: Vladislav Efanov <VEfanov at ispras.ru>
>
> Thanks for the fix but I have a very similar fix already queued in my tree
> in linux-next: 19fd80de0a8 ("udf: Handle error when adding extent to a
> file").
>
> Honza
More information about the lvc-project
mailing list