Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2103350iof; Tue, 7 Jun 2022 19:51:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoPCMm6MbgckpH1lIBenFa7snYGwVdWJJ4p9KR6HPA9EMpLMxcB9XQHVFmAvuhe6ZNGBJ3 X-Received: by 2002:a63:491c:0:b0:3fc:cf5e:f14 with SMTP id w28-20020a63491c000000b003fccf5e0f14mr28382049pga.108.1654656710026; Tue, 07 Jun 2022 19:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656710; cv=none; d=google.com; s=arc-20160816; b=MEGcBwHVzjCMDzVAmTVnIqxiqjSohBh4HcjyajyDLpJGdrMzqgdr90BePY3agv4DGv H4gihLJGZ8NC8z9hv9iwMjrLSlFC8JiIJ3N4/BtntjlX0ryADJy5LIfNG2e5TeIVD5lP nibNKz/KJqmIX169AssX8GzJpo1OxU1d1s0KB3vuOZts2AipJ2mbeSVAU+UbK7PbpS6P HILIu+st/qgVPnZTXjDB2b1kJXnH9yedV9dbjoKj8X0n+EHJx+fDilcmcAIl2EDLcd7X aFa50CyLxDMtl1dN7LcXkxFq/z7lqFTX5OQ+tlQ6rKfBbxMsa9XW43UwPmOzi0Qq5ozc AWrg== 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=Jk+cBbk+Jlwq44ymjmthj9jVu1bQLTFhUjmIW20PMjI=; b=DxWvGhJFrPQer/KOLeDW58+vvl0wDcRyuHwKBe9aefEi1f5eghbqjcL9tBAkzy2ToT 0ivyDPciangYaSxXBqUl4ucBN6byqznT2Lc/CS6YLzp3kG+7VCIfjS6EvW9isL/64HYc wcM/P9xRL8XxoujENiHgV/6/Uvj1R7/hhEog9XPFd58uQL8xlU/E6IweXLrxW22vbhl8 BvYgWyKg4AFOrdrmJyDBg/cEl579ttOAzB1sx7KoOLmkisVHiG1TAbxtkLH4ujMCz+5d 54PmhB5qvoTM4XyDNn9VXOEChW+5oWPIYL0z1oCpdt8gJGOaDqhhwFnr/y+vAB+26lqS o0yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PIJ61amG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mq18-20020a17090b381200b001d99fab8c25si28902376pjb.10.2022.06.07.19.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:51:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PIJ61amG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 702362A25F8; Tue, 7 Jun 2022 18:25:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354050AbiFGVyv (ORCPT + 99 others); Tue, 7 Jun 2022 17:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379200AbiFGVCL (ORCPT ); Tue, 7 Jun 2022 17:02:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E11411E1F3; Tue, 7 Jun 2022 11:46:53 -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 ams.source.kernel.org (Postfix) with ESMTPS id C35EBB8220B; Tue, 7 Jun 2022 18:46:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AC29C385A5; Tue, 7 Jun 2022 18:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627610; bh=eQJDeW28Q8lNsEGx74LsciocffWBnYZhpPkrpvgHptg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PIJ61amGj9mlHBpPzvxHY0DYmalA558cFH6sDK2qvsgnxXRL+5sCqqoTfVS2F/GnG 6Qud4Y2y3ZsPipQ+/sAADGHL8+VCwoxuGGV9Y4jEsDMx5zfsV4DCtNQkUHM5jc70nB +flZWsYlUdUnKRq5/IOIL/c7t3FsEAOp0B5yYbn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Enzo Matsumiya , Steve French Subject: [PATCH 5.18 030/879] cifs: dont call cifs_dfs_query_info_nonascii_quirk() if nodfs was set Date: Tue, 7 Jun 2022 18:52:28 +0200 Message-Id: <20220607165003.550879611@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Enzo Matsumiya commit 421ef3d56513b2ff02e563623688cb6ab4977c4f upstream. Also return EOPNOTSUPP if path is remote but nodfs was set. Fixes: a2809d0e1696 ("cifs: quirk for STATUS_OBJECT_NAME_INVALID returned for non-ASCII dfs refs") Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Enzo Matsumiya Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/connect.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -3432,6 +3432,7 @@ static int is_path_remote(struct mount_c struct cifs_tcon *tcon = mnt_ctx->tcon; struct smb3_fs_context *ctx = mnt_ctx->fs_ctx; char *full_path; + bool nodfs = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS; if (!server->ops->is_path_accessible) return -EOPNOTSUPP; @@ -3449,14 +3450,20 @@ static int is_path_remote(struct mount_c rc = server->ops->is_path_accessible(xid, tcon, cifs_sb, full_path); #ifdef CONFIG_CIFS_DFS_UPCALL + if (nodfs) { + if (rc == -EREMOTE) + rc = -EOPNOTSUPP; + goto out; + } + + /* path *might* exist with non-ASCII characters in DFS root + * try again with full path (only if nodfs is not set) */ if (rc == -ENOENT && is_tcon_dfs(tcon)) rc = cifs_dfs_query_info_nonascii_quirk(xid, tcon, cifs_sb, full_path); #endif - if (rc != 0 && rc != -EREMOTE) { - kfree(full_path); - return rc; - } + if (rc != 0 && rc != -EREMOTE) + goto out; if (rc != -EREMOTE) { rc = cifs_are_all_path_components_accessible(server, xid, tcon, @@ -3468,6 +3475,7 @@ static int is_path_remote(struct mount_c } } +out: kfree(full_path); return rc; }