Skip to content

Commit 0f5be2f

Browse files
Murphy Zhougregkh
authored andcommitted
CIFS: fiemap: do not return EINVAL if get nothing
commit 979a266 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>
1 parent 48a9bc9 commit 0f5be2f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/cifs/smb2ops.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3252,7 +3252,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
32523252
if (rc)
32533253
goto out;
32543254

3255-
if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
3255+
if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
32563256
rc = -EINVAL;
32573257
goto out;
32583258
}

0 commit comments

Comments
 (0)