From patchwork Wed Jun 3 06:38:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11585125 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B490D1391 for ; Wed, 3 Jun 2020 06:38:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C9AF20659 for ; Wed, 3 Jun 2020 06:38:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iw8+znI1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725878AbgFCGiy (ORCPT ); Wed, 3 Jun 2020 02:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgFCGix (ORCPT ); Wed, 3 Jun 2020 02:38:53 -0400 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9F15C05BD43 for ; Tue, 2 Jun 2020 23:38:53 -0700 (PDT) Received: by mail-yb1-xb30.google.com with SMTP id a80so517144ybg.1 for ; Tue, 02 Jun 2020 23:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=8QhEYCy/WaCxm+YdxbbTg4BqfGOuasnYWr56/C1UfVw=; b=iw8+znI1wWTX4shj6A3MFKekzWTFYBn24wPsdXiKK6OhU+5XqBj6gtsM0mIG82q5PP bBlhdP3AqLSxBXXd2VF7bKifKpuZRWM532HHiMoTONzZ9/OYbWJw83XDsc8oLky/7qTm +FIHyCcwJUNIESYBNfhcTdBeWQD1y+DEHBcZ03BLOL+Znk185dt/Y0xvYhVIQSKYKNCY AxK5lVTzyeklu8dYNjEme/o9KrIIZFXWYDYpPWebQ2gPx6fK9jygKzdJs7DCfmRgycPr 1r1hSwoJLEVphJraX+vY36aDVx8QGHEBRuymMuOK2giPRpSbNaRBl//u7KgPePrl5q6e kIjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8QhEYCy/WaCxm+YdxbbTg4BqfGOuasnYWr56/C1UfVw=; b=YfcPWtrrxoiMVwyjCTekPQw1DcaDjnmk8MCW9yzGOOxnXZlYQAkoRFZOQ5XGiD79Hy FMiPqAT8U1omo5WOYH2bvMYfjM3UE2btRnH8V4JSKp+R/P4mX5RQB4gjCEoWcXw163ey jWjaj8IE9najF1oCmqMsgoVM74ISpjpoy7qxOXaF/FRc6ii1/6/MvEtIjFQmaHvgzSjW XqQUJz8F+OEn06d++zaHNE3jQ6lqb9P3lOFm5bLslPIEnLh4wT1K8yyMyLQjWRdQq4Of Qx2RwjNzjKb92TWwMQttAYbRBRgfRXka4CwjlA7C+MT2bQWCHbI6lO1aWOpXI9B3OoOo kygQ== X-Gm-Message-State: AOAM531gvOWS+/couEAxSNCiQu0wAp4yuAgAnUqPnjDBQgpChGXuookE BLeg2ybg4RRBTSfkH+Hvzgh9YjwFnKh0VoA+N0p2hRuu38U= X-Google-Smtp-Source: ABdhPJx3Lbc7MG3UqVNA9FW3d8e2kurLokHJsuEbAWbjoEp+mE+nGCurOYfAPieoKcZKq/m6hAyfONtgin5RF6yxopg= X-Received: by 2002:a25:ec0d:: with SMTP id j13mr7190595ybh.364.1591166332740; Tue, 02 Jun 2020 23:38:52 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Wed, 3 Jun 2020 01:38:41 -0500 Message-ID: Subject: [PATCH][SMB3] fix incorrect number of credits when ioctl MaxOutputResponse > 64K To: CIFS , ronnie sahlberg Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We were not checking to see if ioctl requests asked for more than 64K (ie when CIFSMaxBufSize was > 64K) so when setting larger CIFSMaxBufSize then ioctls would fail with invalid parameter errors. When requests ask for more than 64K in MaxOutputResponse then we need to ask for more than 1 credit. Signed-off-by: Steve French CC: Stable From 8f4201046886f0f7d3f2a78620d0cef0a2deac2b Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 3 Jun 2020 01:33:58 -0500 Subject: [PATCH] smb3: fix incorrect number of credits when ioctl can request > 64K We were not checking to see if ioctl requests asked for more than 64K (ie when CIFSMaxBufSize was > 64K) so when setting larger CIFSMaxBufSize then ioctls would fail with invalid parameter errors. When requests ask for more than 64K then we need to ask for more than 1 credit. Signed-off-by: Steve French CC: Stable --- fs/cifs/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index af067fd30ddb..ded96b529a4d 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2973,7 +2973,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server, * response size smaller. */ req->MaxOutputResponse = cpu_to_le32(max_response_size); - + req->sync_hdr.CreditCharge = cpu_to_le16(DIV_ROUND_UP(max_response_size, SMB2_MAX_BUFFER_SIZE)); if (is_fsctl) req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); else -- 2.25.1