]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 09:57:32 +0000 (10:57 +0100)
commit 37941ea17d3f8eb2f5ac2f59346fab9e8439271a upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smbdirect.c

index e6ec5f6d276e7ab212bb0075c67496893cc09809..784628ec4bc40f8f7dfc8ce460668d77ad86f9a0 100644 (file)
@@ -1164,7 +1164,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);