From: Long Li Date: Tue, 17 Apr 2018 19:17:05 +0000 (-0700) Subject: cifs: smbd: Check for iov length on sending the last iov X-Git-Tag: v4.16.5~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d931c6adf5def75d1bc36ec1e17458b1d3045e9;p=thirdparty%2Fkernel%2Fstable.git cifs: smbd: Check for iov length on sending the last iov commit ab60ee7bf9a84954f50a66a3d835860e80f99b7f upstream. When sending the last iov that breaks into smaller buffers to fit the transfer size, it's necessary to check if this is the last iov. If this is the latest iov, stop and proceed to send pages. Signed-off-by: Long Li Cc: stable@vger.kernel.org Signed-off-by: Steve French Reviewed-by: Ronnie Sahlberg Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 52cccdbb7e140..34be5c5d027fd 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -2194,6 +2194,8 @@ int smbd_send(struct smbd_connection *info, struct smb_rqst *rqst) goto done; } i++; + if (i == rqst->rq_nvec) + break; } start = i; buflen = 0;