]> git.hungrycats.org Git - linux/commitdiff
cifs: smbd: Check for iov length on sending the last iov
authorLong Li <longli@microsoft.com>
Tue, 17 Apr 2018 19:17:05 +0000 (12:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Apr 2018 09:00:35 +0000 (11:00 +0200)
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 <longli@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/smbdirect.c

index 52cccdbb7e1403e3d29df4ae8b6a6dfcb91cbe7b..34be5c5d027fdd3c986fdcacb3f7029364640911 100644 (file)
@@ -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;