diff options
| author | Huiwen He <hehuiwen@kylinos.cn> | 2026-08-28 15:19:33 +0800 |
|---|---|---|
| committer | Paulo Alcantara <pc@manguebit.org> | 2026-08-30 14:04:20 -0300 |
| commit | 7811701d6af7db76481a82b9bc3c4adf7863acf5 (patch) | |
| tree | d91266552f0a23d2b95776e1f374e386b25b7376 /include/linux/timerqueue_types.h | |
| parent | 0923ae9f23cc9460b0df6fc124cd56ec4436411b (diff) | |
smb/client: fix integer truncation in collapse range
smb3_collapse_range() stores the ssize_t return value of
smb2_copychunk_range() in an int. A successful copy larger than
INT_MAX is truncated to a negative value and treated as an error.
Reproducer:
MNT=/mnt/scratch
truncate -s 2056M "$MNT/file"
fallocate --collapse-range -o 1M -l 1M "$MNT/file"
Fix this by using __smb2_copychunk_range(), which reports success as
zero instead of returning the copied byte count.
Before this change, the reproducer fails with:
fallocate: fallocate failed: Success
and the file size remains unchanged at 2056 MiB. After this change, the
reproducer succeeds and the file size becomes the expected 2055 MiB.
Fixes: 5476b5dd82c8 ("cifs: add support for FALLOC_FL_COLLAPSE_RANGE")
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Diffstat (limited to 'include/linux/timerqueue_types.h')
0 files changed, 0 insertions, 0 deletions
