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: 899005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxonhyperv.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40Q6RK2tRPz9s1B for ; Tue, 17 Apr 2018 11:02:21 +1000 (AEST) 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 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;