Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp448760iog; Mon, 13 Jun 2022 06:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSjEV1+KCwO7akXgvoaxPgHE5O16+Ye1vEZrSMNFg1PIcOsSn4F4oWB2uMmPrSOKkAGWIH X-Received: by 2002:a63:5d19:0:b0:3ff:124a:e8e9 with SMTP id r25-20020a635d19000000b003ff124ae8e9mr21062346pgb.218.1655125423980; Mon, 13 Jun 2022 06:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125423; cv=none; d=google.com; s=arc-20160816; b=hcEv8No9PSEa3tH5n4M9YyrFnNxsXoeivP5WTH9ZfE/lWCRlbDi+W3HMr6V/vN9mtN +jrudWziAgdJ+sW52KexcYJ7jccI1feYieGcT6jKve6vmYaSOkxP+kPlKqTt6RwUDRqf 9xiCgGZyic57AOo2Dx8VwHruqf/fDJLPZpzCvEPYuOV1CVjYNcx9IEH+fGeX6Fyz+YYd IV5ja6E/qoiCEUzAarcDQS0IsT8uzvwMlu6M6s0NokFRGjERcc4Rhlu+iuadwhFh3u27 JN+lyQsC/UxcoO7TEissrDx88IbOTalj3XG9qPUe+AM4hon3ZfaSTNO8+09pq7gYISiL vjSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QMOoGIYXtqrC4fgJk1Q7wCm3mTRk6CqyQQH9HqjJ2bo=; b=GIIW4PdaOIUs4BG1G6PTDnVSJdJeGIzwHhnIIn8S98AxFvXbqY2YY8pD4jxTn4srON /mzI6RbGMevvj6uLmNZnlDpaioeV8qkHLRQcsTEtxSAVzBnQpNHrr1MWVdq4Lu/aCIeP iwp0QqDQTMcfEWMyFvPMpWUyOd/9yVj1LYfVj5LhYIy+NjHHwrqKzq5oyPZNPJ1UBD98 OaIFKhMBqaIZLh6g89igBsgchYaxxpIQhWdQLI57nfWyOCL8RFkaQxULhFbQY+rttsJr yNJdF0Dv1Q0S6m4zYTAhsRzXotQkQK20hahFjfwJdYNgLRy4828sC0n560IeosVXnOnV Feig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PxdRnd1X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a056a00141100b0051c2af24938si10756706pfu.190.2022.06.13.06.03.29; Mon, 13 Jun 2022 06:03:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PxdRnd1X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356010AbiFMLtu (ORCPT + 99 others); Mon, 13 Jun 2022 07:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357475AbiFMLqM (ORCPT ); Mon, 13 Jun 2022 07:46:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B298637B; Mon, 13 Jun 2022 03:52:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 050566135C; Mon, 13 Jun 2022 10:52:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12C88C34114; Mon, 13 Jun 2022 10:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117541; bh=8XodZh5sCr/MfT0L5lf3vACVky82khXDRn8yFleVMQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PxdRnd1Xk+rdgTUnB0r0m3kTicm1yI4wL80mgjHvnmdrwNwmvU/yRjVz6gTurywKO 7Em2TUFgUjX0x5rN2ejSqvF/ffjnU3QnQ8jATHLg5r2Xdbr0thPzZL8s8Lue836Fhg IOhIEBk0XhOAQk9jCaPW4BzusJYkt+TfBQ5zbZiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 5.4 396/411] cifs: version operations for smb20 unneeded when legacy support disabled Date: Mon, 13 Jun 2022 12:11:09 +0200 Message-Id: <20220613094940.538389739@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve French [ Upstream commit 7ef93ffccd55fb0ba000ed16ef6a81cd7dee07b5 ] We should not be including unused smb20 specific code when legacy support is disabled (CONFIG_CIFS_ALLOW_INSECURE_LEGACY turned off). For example smb2_operations and smb2_values aren't used in that case. Over time we can move more and more SMB1/CIFS and SMB2.0 code into the insecure legacy ifdefs Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/cifsglob.h | 4 +++- fs/cifs/smb2ops.c | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 9c0e348cb00f..414936989255 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -1930,11 +1930,13 @@ extern mempool_t *cifs_mid_poolp; /* Operations for different SMB versions */ #define SMB1_VERSION_STRING "1.0" +#define SMB20_VERSION_STRING "2.0" +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY extern struct smb_version_operations smb1_operations; extern struct smb_version_values smb1_values; -#define SMB20_VERSION_STRING "2.0" extern struct smb_version_operations smb20_operations; extern struct smb_version_values smb20_values; +#endif /* CIFS_ALLOW_INSECURE_LEGACY */ #define SMB21_VERSION_STRING "2.1" extern struct smb_version_operations smb21_operations; extern struct smb_version_values smb21_values; diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 7985fe25850b..57164563eec6 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3487,11 +3487,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, } } +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY static bool smb2_is_read_op(__u32 oplock) { return oplock == SMB2_OPLOCK_LEVEL_II; } +#endif /* CIFS_ALLOW_INSECURE_LEGACY */ static bool smb21_is_read_op(__u32 oplock) @@ -4573,7 +4575,7 @@ smb2_make_node(unsigned int xid, struct inode *inode, return rc; } - +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY struct smb_version_operations smb20_operations = { .compare_fids = smb2_compare_fids, .setup_request = smb2_setup_request, @@ -4670,6 +4672,7 @@ struct smb_version_operations smb20_operations = { .fiemap = smb3_fiemap, .llseek = smb3_llseek, }; +#endif /* CIFS_ALLOW_INSECURE_LEGACY */ struct smb_version_operations smb21_operations = { .compare_fids = smb2_compare_fids, @@ -4987,6 +4990,7 @@ struct smb_version_operations smb311_operations = { .llseek = smb3_llseek, }; +#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY struct smb_version_values smb20_values = { .version_string = SMB20_VERSION_STRING, .protocol_id = SMB20_PROT_ID, @@ -5007,6 +5011,7 @@ struct smb_version_values smb20_values = { .signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED, .create_lease_size = sizeof(struct create_lease), }; +#endif /* ALLOW_INSECURE_LEGACY */ struct smb_version_values smb21_values = { .version_string = SMB21_VERSION_STRING, -- 2.35.1