From patchwork Tue Apr 17 00:49:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10344101 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 071CB60548 for ; Tue, 17 Apr 2018 01:02:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBB6528830 for ; Tue, 17 Apr 2018 01:02:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFD7D28861; Tue, 17 Apr 2018 01:02:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6163828830 for ; Tue, 17 Apr 2018 01:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751187AbeDQBCU (ORCPT ); Mon, 16 Apr 2018 21:02:20 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:60352 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbeDQBCT (ORCPT ); Mon, 16 Apr 2018 21:02:19 -0400 X-Greylist: delayed 676 seconds by postgrey-1.27 at vger.kernel.org; Mon, 16 Apr 2018 21:02:19 EDT Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id 8EoYfs1FlRnIx8EoYfv9bO; Mon, 16 Apr 2018 17:50:02 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.89_1) (envelope-from ) id 1f8EoY-0007cg-8W; Mon, 16 Apr 2018 17:49:42 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, stable@vger.kernel.org Cc: Long Li Subject: [PATCH 1/6] cifs: smbd: Check for iov length on sending the last iov Date: Mon, 16 Apr 2018 17:49:13 -0700 Message-Id: <20180417004918.29213-1-longli@linuxonhyperv.com> X-Mailer: git-send-email 2.15.1 Reply-To: longli@microsoft.com X-CMAE-Envelope: MS4wfP4N6ubxwmwRb4BfbpL3lDGzZhZP+lZl8mCXslQW9GIIEBzsU8hKslmNVl1nR+88F3qUpncPxNXVZPXBtwdnOnpTRTitnvT8pd09wZ4ubT49tR853y9+ GvDYBLKDp7uWx9V9eB010Ss+DETrTSf+0LUHB8z1s909WBihzPKKUku0yq4UII8aeLjfW0tDXSjdLKUDz8D7wk0ZAMZJGZ45bBdZ1d4Dm4g49n67Quvu5DeI RGAs9PmliuI8GuzWco8jBB5yijR+GBY4xP+26oiDrgL9Mc9zdcFPTGGt6hWhMuWG2PvJwkqUyhNyJgjxrfNfMsBZvNCdCnmd3Q9RTmByxSKidT4B1fNhpr2X AAUcpaWBF+i6pbaRwszZhaWf8cQd1lMr3Vef6Pps8QQ5FuXND1nWMMUrKN5eipBaEmtsNlAkpPovkTAScsyqHSiYKBHFAaVk7PRWSAXwloYiDRvLGRg= Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li 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 --- fs/cifs/smbdirect.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index 90e673c..b5c6c0d 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -2197,6 +2197,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;