From patchwork Wed Jan 23 21:10:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 10777885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47D836C2 for ; Wed, 23 Jan 2019 21:10:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3857E2D7AB for ; Wed, 23 Jan 2019 21:10:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CEBA2D7B2; Wed, 23 Jan 2019 21:10:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 CF45B2D7AB for ; Wed, 23 Jan 2019 21:10:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbfAWVK5 (ORCPT ); Wed, 23 Jan 2019 16:10:57 -0500 Received: from mail-pg1-f178.google.com ([209.85.215.178]:44460 "EHLO mail-pg1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbfAWVK5 (ORCPT ); Wed, 23 Jan 2019 16:10:57 -0500 Received: by mail-pg1-f178.google.com with SMTP id t13so1616902pgr.11 for ; Wed, 23 Jan 2019 13:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=fzzqNKTWwQT2+XfhBsjdKi5VkKGeSCzOQqeJgml7JIs=; b=TNQb64G2+LgWYUqJxGUugm1ayYDuWV+9fwG2/jZC6c9mo2LqqtNGfUW2EtsdHzmsv2 n4safGLJfrTla2OXtk3H2SCnqeW8RKwOYycDSPRkuHOmX2fyacz7IXYp3O1zde+Y5A7Q LNXycaZG2Xv4o2NcZMu+RUE7QoAsdm1C3NnytThIEPqF2ZXTfN0wQaAXjzmTmCMF4zkG oiGFdhIrX/2G+O581SwiLbLHsr0jWOF5/fM/lnraI2lQ/AKRGZVHE1O7LgqaZz10wKB2 M4H2unt/O6n+OX865Zl2jGilZ8eKoX7tF9ITqO6yd/gzSKzVAvOUM2zHwJoqVhZg/TFj C8Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fzzqNKTWwQT2+XfhBsjdKi5VkKGeSCzOQqeJgml7JIs=; b=uGwze25oUPa5z6e/zkF3sU7OVj23ysPpogdbDhLIrGJBou4pnGKxMhLAbpSJhtAWH0 3OL2dDjxwcwshFqDO9xt0SOZN7BxU5vPJ9EctbGLoR58QOODQSwK6jlcYAkuGYGLptLw S8EEGsRkqgKFfrYHsKEHQjzy8lV+462aHbDw8fTWyaJ6EFa0eab4A0mmjuhio8AweOqd 6jaBmXpaE8e/7MVX3OcWA2+Lep2s3pku0l/hLLUl9isq6o+2Deabp0d3SXZyu7s+u8sx oRbd6s8Pe8CTITPRBVzcjl9vNzAVkbmJlrJH/iiHt7/1Y9PapJJLoQz8jL+ZJru7d+T5 qLpA== X-Gm-Message-State: AJcUukcF/tSluht9lbcusyVy7RX4mb4vg5KJ07X9qrkdRSuYN6rFuQ2x L/gni+HibhxKFbkCynzBJIYj2Ww= X-Google-Smtp-Source: ALg8bN4VIOsYRM1kTiqgvl5tdEmPkgCZZsz+S2RkDLfLzQ6uAD/TxTAppopmNK26SwL2BoBmIJ5+RQ== X-Received: by 2002:a63:4d66:: with SMTP id n38mr3489250pgl.270.1548277855891; Wed, 23 Jan 2019 13:10:55 -0800 (PST) Received: from ubuntu-vm.corp.microsoft.com ([2001:4898:80e8:f:a17f:4e9f:6b7c:507d]) by smtp.gmail.com with ESMTPSA id n73sm28063714pfj.148.2019.01.23.13.10.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Jan 2019 13:10:54 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: linux-cifs@vger.kernel.org, Steve French , Ronnie Sahlberg Subject: [PATCH 03/15] CIFS: Fix credit calculation for encrypted reads with errors Date: Wed, 23 Jan 2019 13:10:33 -0800 Message-Id: <1548277845-6746-4-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548277845-6746-1-git-send-email-pshilov@microsoft.com> References: <1548277845-6746-1-git-send-email-pshilov@microsoft.com> 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 We do need to account for credits received in error responses to read requests on encrypted sessions. Cc: Signed-off-by: Pavel Shilovsky --- fs/cifs/smb2ops.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 3b6c95d..24a19f2 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3192,11 +3192,23 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, server->ops->is_status_pending(buf, server, 0)) return -1; - rdata->result = server->ops->map_error(buf, false); + /* set up first two iov to get credits */ + rdata->iov[0].iov_base = buf; + rdata->iov[0].iov_len = 4; + rdata->iov[1].iov_base = buf + 4; + rdata->iov[1].iov_len = + min_t(unsigned int, buf_len, server->vals->read_rsp_size) - 4; + cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", + rdata->iov[0].iov_base, rdata->iov[0].iov_len); + cifs_dbg(FYI, "1: iov_base=%p iov_len=%zu\n", + rdata->iov[1].iov_base, rdata->iov[1].iov_len); + + rdata->result = server->ops->map_error(buf, true); if (rdata->result != 0) { cifs_dbg(FYI, "%s: server returned error %d\n", __func__, rdata->result); - dequeue_mid(mid, rdata->result); + /* normal error on read response */ + dequeue_mid(mid, false); return 0; } @@ -3269,14 +3281,6 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, return 0; } - /* set up first iov for signature check */ - rdata->iov[0].iov_base = buf; - rdata->iov[0].iov_len = 4; - rdata->iov[1].iov_base = buf + 4; - rdata->iov[1].iov_len = server->vals->read_rsp_size - 4; - cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", - rdata->iov[0].iov_base, server->vals->read_rsp_size); - length = rdata->copy_into_pages(server, rdata, &iter); kfree(bvec);