From: Long Li Date: Wed, 16 Oct 2019 20:51:52 +0000 (-0700) Subject: cifs: smbd: Return -EINVAL when the number of iovs exceeds SMBDIRECT_MAX_SGE X-Git-Tag: v5.4.6~51 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68dcbbd067e2873ac871722bc0a4586bd4648cab;p=thirdparty%2Fkernel%2Fstable.git cifs: smbd: Return -EINVAL when the number of iovs exceeds SMBDIRECT_MAX_SGE 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 Cc: stable@vger.kernel.org Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index bf681c7e66896..b442bfaf292b5 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -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);