1
0
Fork 0

CIFS: fiemap: do not return EINVAL if get nothing

commit 979a2665eb upstream.

If we call fiemap on a truncated file with none blocks allocated,
it makes sense we get nothing from this call. No output means
no blocks have been counted, but the call succeeded. It's a valid
response.

Simple example reproducer:
xfs_io -f 'truncate 2M' -c 'fiemap -v' /cifssch/testfile
xfs_io: ioctl(FS_IOC_FIEMAP) ["/cifssch/testfile"]: Invalid argument

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5.4-rM2-2.2.x-imx-squashed
Murphy Zhou 2020-03-14 11:38:31 +08:00 committed by Greg Kroah-Hartman
parent 48a9bc9534
commit 0f5be2f69e
1 changed files with 1 additions and 1 deletions

View File

@ -3252,7 +3252,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
if (rc)
goto out;
if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
rc = -EINVAL;
goto out;
}