Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4431056ioa; Wed, 27 Apr 2022 03:50:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh/h3QQKbE6//5QXzPUZoNxuj2252OPu1cumYwgJDtKPB1Oes5fmdYS83XhPk/MbyicA02 X-Received: by 2002:a05:6a00:1da0:b0:50d:4d87:566e with SMTP id z32-20020a056a001da000b0050d4d87566emr10595888pfw.13.1651056643271; Wed, 27 Apr 2022 03:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651056643; cv=none; d=google.com; s=arc-20160816; b=yHZlJYjK4Bnz3d2VQ/MTQRo9Lwv1wjRqaABrhzbzS8Z7oWC25phiSugSmrtuzNTnDS MuCC7pnG/BWQh8K8cNWCRL/9ntxfd9O8Z5V9/a4o8d//n/ie1OFvmQ7EBZhaNnrTsAfe n9Ck06/hEwPmWkBEThhKicmD446cakU6UjGVnBJtDGeD/4abkbP3GLYKr+RBhqqetoJV 93pRAMzCxbJopTCViup06yVhJvDeNIRkT+8FoBse7bxJFSQ61iCR8NDLRmrwfkwikwnI aJ4jwPB9UsXFZBnwrg830NGkAjiOYwIDiDsFCn1Ds/A9DhRRN6vFNPD7xT2+WwTLzta0 rSDA== 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=YYI1FTjPPzQiXLRFvRDi/SLOk1ThbiFVjk6L7SARAcw=; b=mgi2bTNFXTKAWW6a9Gz+zU0oIgVcWI767SELUWCj0U1D7nev+5v9LdouqCYCmWGCaZ o62gk2lM9rksVlBgcsuxUcnAVG8/GR7Q4ePeKD3/Np3NcXv7wyL/I53nRN6SMcqFxjIN fRXgiQP1nr7Et1txtCUztGR+mKy9HI3fFfQLRFQ3TE2ZYlpZU5RS4yW3+OzPyx/XCVK1 0SZ9BRITzIg43UqOhCFPPOYHJBsjsNKP3vQgejewCKreRGk5myJRb3mfIkl2oce3ar8v aElurkxMvfmSvB6ZWqO/VZ411AY6DktcJCbKzRFKAeNlKRrnq7wKFMEyeAWq3iHrym86 mPmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EmbJx3Ar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q30-20020a635c1e000000b003ab2119be06si1166603pgb.82.2022.04.27.03.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EmbJx3Ar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A7E4418E46; Wed, 27 Apr 2022 02:56:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347656AbiDZJgQ (ORCPT + 99 others); Tue, 26 Apr 2022 05:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345944AbiDZJG3 (ORCPT ); Tue, 26 Apr 2022 05:06:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11F4F13566A; Tue, 26 Apr 2022 01:47:48 -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 9D1DE60C42; Tue, 26 Apr 2022 08:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1CB2C385A0; Tue, 26 Apr 2022 08:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962867; bh=QGISIWt0xAu7CrLpvK0e1CfLL9c0uHmU/rChXAc3JGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EmbJx3ArBMhbtv8GYHAe+SpRR3D4cYaq+8qE90oKNMxrsq1PbbY5aclUDtB/zZP/W 0ZgDq5VvNTPI03G33Os/vdi9chXUgr95p75XrrQm2GCnEYf340x2b8iCf6BVG3SAu0 jZ8QCpwgSBaGjpWRF+wTPw9uwl9GtITLkYWzjza8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Ronnie Sahlberg , Steve French Subject: [PATCH 5.17 116/146] cifs: use correct lock type in cifs_reconnect() Date: Tue, 26 Apr 2022 10:21:51 +0200 Message-Id: <20220426081753.317688313@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081750.051179617@linuxfoundation.org> References: <20220426081750.051179617@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=-2.5 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 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: Paulo Alcantara commit cd70a3e8988a999c42d307d2616a5e7b6a33c7c8 upstream. TCP_Server_Info::origin_fullpath and TCP_Server_Info::leaf_fullpath are protected by refpath_lock mutex and not cifs_tcp_ses_lock spinlock. Signed-off-by: Paulo Alcantara (SUSE) Cc: stable@vger.kernel.org Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/connect.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -534,12 +534,19 @@ int cifs_reconnect(struct TCP_Server_Inf { /* If tcp session is not an dfs connection, then reconnect to last target server */ spin_lock(&cifs_tcp_ses_lock); - if (!server->is_dfs_conn || !server->origin_fullpath || !server->leaf_fullpath) { + if (!server->is_dfs_conn) { spin_unlock(&cifs_tcp_ses_lock); return __cifs_reconnect(server, mark_smb_session); } spin_unlock(&cifs_tcp_ses_lock); + mutex_lock(&server->refpath_lock); + if (!server->origin_fullpath || !server->leaf_fullpath) { + mutex_unlock(&server->refpath_lock); + return __cifs_reconnect(server, mark_smb_session); + } + mutex_unlock(&server->refpath_lock); + return reconnect_dfs_server(server); } #else