From patchwork Mon Jul 6 15:23:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Alcantara X-Patchwork-Id: 11646049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA10960D for ; Mon, 6 Jul 2020 15:32:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB54820720 for ; Mon, 6 Jul 2020 15:32:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cjr.nz header.i=@cjr.nz header.b="qwUAQAtG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729248AbgGFPcF (ORCPT ); Mon, 6 Jul 2020 11:32:05 -0400 Received: from mx.cjr.nz ([51.158.111.142]:53966 "EHLO mx.cjr.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729197AbgGFPcF (ORCPT ); Mon, 6 Jul 2020 11:32:05 -0400 Received: from authenticated-user (mx.cjr.nz [51.158.111.142]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pc) by mx.cjr.nz (Postfix) with ESMTPSA id 68B87804BF; Mon, 6 Jul 2020 15:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cjr.nz; s=dkim; t=1594049125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e3D52vmquxgLRJCDQl8eEKkTpQPdfBg9ZA11l30YxvQ=; b=qwUAQAtGMoDH8bw5TO5PdJk7pfalKd/JvBXoyUaTCF6QobiPawSbXb2e5yWTrWbdC4Pk42 K2MEu32JSNAVYPuYTAwiXvTIbuoPw7/tyM4ZaTs3RKmEnKG99hHRs4LmXpogtEvx9QE9J5 530b1saNgX3L3F+vI+QtfjYdAnxvsWN8OlrxopoRWAtYaM1DPdCL/M+tnF62KD+4btoeIu Oedaq4Hvrgvq+Ox13iVKmKwk6AT6rgn+PgGxy8kbPBHOHNqUOuSBT4RnmbWSTPD55Nqjz3 H3qz+D31F+h3ZjiZe7YK9fxOfn4mqi/pX0tXHQE0IfHvjZZLH42lTo6aUIj9Hg== From: Paulo Alcantara To: linux-cifs@vger.kernel.org, smfrench@gmail.com Cc: Paulo Alcantara Subject: [PATCH 4/7] cifs: handle empty list of targets in cifs_reconnect() Date: Mon, 6 Jul 2020 12:23:59 -0300 Message-Id: <20200706152402.5721-5-pc@cjr.nz> In-Reply-To: <20200706152402.5721-1-pc@cjr.nz> References: <20200706152402.5721-1-pc@cjr.nz> MIME-Version: 1.0 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org In case there were no cached DFS referrals in reconn_setup_dfs_targets(), set cifs_sb to NULL prior to calling reconn_set_next_dfs_target() so it would not try to access an empty tgt_list. Signed-off-by: Paulo Alcantara (SUSE) --- fs/cifs/connect.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b90ee86c0523..721ef2a53f65 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -470,11 +470,13 @@ cifs_reconnect(struct TCP_Server_Info *server) sb = NULL; } else { cifs_sb = CIFS_SB(sb); - rc = reconn_setup_dfs_targets(cifs_sb, &tgt_list); - if (rc && (rc != -EOPNOTSUPP)) { - cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n", - __func__); + if (rc) { + cifs_sb = NULL; + if (rc != -EOPNOTSUPP) { + cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n", + __func__); + } } else { server->nr_targets = dfs_cache_get_nr_tgts(&tgt_list); }