summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorMurphy Zhou <jencce.kernel@gmail.com>2020-03-14 11:38:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-25 08:27:04 +0100
commit482705329d51837c7d4bb83072870186a01b8a6d (patch)
tree5c7574839355aa0c53a09a53ff88c48167a58dd1 /fs/cifs
parentc3973e942b5d096a8715bbd51b623aff7b26f124 (diff)
CIFS: fiemap: do not return EINVAL if get nothing
commit 979a2665eb6c603ddce0ab374041ab101827b2e7 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>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/smb2ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 5b62840853ff..05a73af0e8c8 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -3315,7 +3315,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;
}