Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp619582iog; Mon, 13 Jun 2022 09:16:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgU+Ltr3zv1itB1Ayo3omGFwmTLpluGE833g4dz7gYyUlJtx0/AobASn492K1QdMtYttjj X-Received: by 2002:a65:6499:0:b0:3fc:dcaa:ad62 with SMTP id e25-20020a656499000000b003fcdcaaad62mr326035pgv.63.1655136986993; Mon, 13 Jun 2022 09:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655136986; cv=none; d=google.com; s=arc-20160816; b=J1LThq1k52YPng0eRR9Jpng4ExTIu3HrEPK5fIzc4qhstLYqQRK/fXUwiMwsdbg5Hg w0+C9wUs7SiYGZaqyTgN+kk5sNjmutWlqeEO4mrYbXk5GlGtG7gqzdF82KG/oFjAim9R 85NoMhJlh1ZqmrvlUbdkIfSuaOetafB/O6f/Wv/O72K7LsllFW5+mpr7aT7IzML04+qK dtzmBKURT1ReFWv1VH0LqxSPwXbBF4GQNAzCavs7pfV9RhunCemBq5PLyUO3afUhLEmZ cwCuVE6dA6fr++yMGEIwLyLITldqR6/IHT5U5rEqxXha3ieBNEBwp9Nnvh47qSvXuphN 0ByA== 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=6h6Kl6s5lSK9PKTJ8QqE/8Q3ZsTEYYDzqqUXmNxpqk4=; b=R9fMT5mgj7GR45RpGMOsYou/CBukIeNOHiJWJcJSvOc8DbjHmoXoR4cIcKjDIP0Bdz fr/u/UPVAip1+jlL+0U/5ubLQcEKr4koGjE76kAkKzeNcPgJg5N6e2TJ8GZfP+R1JhAC ddquQtUcKfDfM5smUHmMCmk+7C/DWWfryPkD/omnDiZiqXrl1iVWtNuvNFOsm/n/XFnu F9stnyzqa8iRMX80E1QsRFeTWJ3ul6ZdGqwjZSQO8Avaopr3IGQdZ4WgYdVN3+WN+SXJ gDCecSVqMiF05g5aljpsgPa/r4GCbQK2tpmfb+fkQF+LxsCSClbmtNV2AQKwNSvP5hjI Zm3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UYRuPrOq; 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 l2-20020a170903244200b00153b2d16577si11145627pls.383.2022.06.13.09.16.12; Mon, 13 Jun 2022 09:16:26 -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=UYRuPrOq; 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 S1343567AbiFMKdV (ORCPT + 99 others); Mon, 13 Jun 2022 06:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346516AbiFMKaf (ORCPT ); Mon, 13 Jun 2022 06:30:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A2A21E30; Mon, 13 Jun 2022 03:21: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 ams.source.kernel.org (Postfix) with ESMTPS id 84D1EB80E93; Mon, 13 Jun 2022 10:21:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB8A2C34114; Mon, 13 Jun 2022 10:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115679; bh=S2nyjzDsl6Qa9SKaZ1k8jiwAYyN6hsEchmkf/gZk/wI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UYRuPrOqFzSHvJNicUREVmj1n3y78i+rzobHmFxepfwGUIsDKg5bA/ySynEuNRPa/ 7bYvi+udlcwYTMcyXbzbK+3bp8wMIHWZ9Pl/EhU6TCzunmUhwkMzBmc0jh+b0zYBRH W1865mb90dYVt5YhQGf5GEepY4p22XM79nwnt5Gk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , Enzo Matsumiya , Steve French Subject: [PATCH 4.9 159/167] cifs: return errors during session setup during reconnects Date: Mon, 13 Jun 2022 12:10:33 +0200 Message-Id: <20220613094918.253916137@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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: Shyam Prasad N commit 8ea21823aa584b55ba4b861307093b78054b0c1b upstream. During reconnects, we check the return value from cifs_negotiate_protocol, and have handlers for both success and failures. But if that passes, and cifs_setup_session returns any errors other than -EACCES, we do not handle that. This fix adds a handler for that, so that we don't go ahead and try a tree_connect on a failed session. Signed-off-by: Shyam Prasad N Reviewed-by: Enzo Matsumiya Cc: stable@vger.kernel.org Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -265,6 +265,9 @@ smb2_reconnect(__le16 smb2_command, stru rc = -EHOSTDOWN; mutex_unlock(&tcon->ses->session_mutex); goto failed; + } else if (rc) { + mutex_unlock(&ses->session_mutex); + goto out; } } if (rc || !tcon->need_reconnect) {