From patchwork Thu Jan 30 18:38:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 232386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26216C2D0DB for ; Thu, 30 Jan 2020 18:43:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD5B42082E for ; Thu, 30 Jan 2020 18:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409782; bh=tanSl7zZw6ER89CgvTLunSlXW80ePu4bovf+hRiok1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CilkdSghQC0sY7cRMYA/0Kg0Lyz4SGCTFvk8SFvCQNjOXYRj9LN4ofF6PZ4Z/wvKs exN9LlyzsS3fFsLT+IZ2Z27OO4DLZbo4U1M6dpvJ6sp9Eufth1M6Un87CZ4WHHHloK c/mhhsMBKKF7ngiXtSkSOEKY8CSK7D+b7sidlyno= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730512AbgA3SnA (ORCPT ); Thu, 30 Jan 2020 13:43:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:51468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730507AbgA3SnA (ORCPT ); Thu, 30 Jan 2020 13:43:00 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEE5F20CC7; Thu, 30 Jan 2020 18:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409779; bh=tanSl7zZw6ER89CgvTLunSlXW80ePu4bovf+hRiok1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwaJfMJbU/MmQP/OO8FHavfEANSKqcarxrfBKStNzvi/Gvn29pCPuL2rYdRm+QrhW vMuPH5Fo0ZavJZLuSderqJweA2OBlofvEHcq/yZV7EU7Hg5PN7gWHbnjRUG2kRMcj6 t2NXhxToSbbdMtoLyLl/LWV+NR3eDw3DBTS1hDQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French , Pavel Shilovsky Subject: [PATCH 5.4 029/110] cifs: set correct max-buffer-size for smb2_ioctl_init() Date: Thu, 30 Jan 2020 19:38:05 +0100 Message-Id: <20200130183618.763906701@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ronnie Sahlberg commit 731b82bb1750a906c1e7f070aedf5505995ebea7 upstream. Fix two places where we need to adjust down the max response size for ioctl when it is used together with compounding. Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Reviewed-by: Pavel Shilovsky CC: Stable Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2ops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -1461,7 +1461,9 @@ smb2_ioctl_query_info(const unsigned int COMPOUND_FID, COMPOUND_FID, qi.info_type, true, buffer, qi.output_buffer_length, - CIFSMaxBufSize); + CIFSMaxBufSize - + MAX_SMB2_CREATE_RESPONSE_SIZE - + MAX_SMB2_CLOSE_RESPONSE_SIZE); } } else if (qi.flags == PASSTHRU_SET_INFO) { /* Can eventually relax perm check since server enforces too */ @@ -2634,7 +2636,10 @@ smb2_query_symlink(const unsigned int xi rc = SMB2_ioctl_init(tcon, &rqst[1], fid.persistent_fid, fid.volatile_fid, FSCTL_GET_REPARSE_POINT, - true /* is_fctl */, NULL, 0, CIFSMaxBufSize); + true /* is_fctl */, NULL, 0, + CIFSMaxBufSize - + MAX_SMB2_CREATE_RESPONSE_SIZE - + MAX_SMB2_CLOSE_RESPONSE_SIZE); if (rc) goto querty_exit;