cifs: smbd: Return -EINVAL when the number of iovs exceeds SMBDIRECT_MAX_SGE
authorLong Li <longli@microsoft.com>
Wed, 16 Oct 2019 20:51:52 +0000 (13:51 -0700)
committerSteve French <stfrench@microsoft.com>
Mon, 25 Nov 2019 07:14:15 +0000 (01:14 -0600)
While it's not friendly to fail user processes that issue more iovs
than we support, at least we should return the correct error code so the
user process gets a chance to retry with smaller number of iovs.

Signed-off-by: Long Li <longli@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smbdirect.c

index 3c91fa9..64c5b87 100644 (file)
@@ -1069,7 +1069,7 @@ static int smbd_post_send_data(
 
        if (n_vec > SMBDIRECT_MAX_SGE) {
                cifs_dbg(VFS, "Can't fit data to SGL, n_vec=%d\n", n_vec);
-               return -ENOMEM;
+               return -EINVAL;
        }
 
        sg_init_table(sgl, n_vec);