From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45BEE8472 for ; Thu, 27 Oct 2022 16:55:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A22D5C433D7; Thu, 27 Oct 2022 16:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666889752; bh=QiJYl/0ZnF4hd0m5qqfzZEMa2wB/wbE4dtOkjj7V5uM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Syajmlc2qi8uRttHQZq5h9Sth11V1QIGyfn61DIA5TvL9909PXW8X9dnP8ecU4fhr XLgPiqwnsjCpFr3NYJD5e0hZncaOW8G976gyzX/V2VpV8ki29mS88iAYH49kNbU2NE /meFCgPlRCepNLmnJOtSP/ssFVNpIXxBCP+VOT3U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bharath SM , Shyam Prasad N , Steve French Subject: [PATCH 6.0 04/94] smb3: interface count displayed incorrectly Date: Thu, 27 Oct 2022 18:54:06 +0200 Message-Id: <20221027165057.358210870@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221027165057.208202132@linuxfoundation.org> References: <20221027165057.208202132@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Steve French commit 096bbeec7bd6fb683831a9ca4850a6b6a3f04740 upstream. The "Server interfaces" count in /proc/fs/cifs/DebugData increases as the interfaces are requeried, rather than being reset to the new value. This could cause a problem if the server disabled multichannel as the iface_count is checked in try_adding_channels to see if multichannel still supported. Also fixes a coverity warning: Addresses-Coverity: 1526374 ("Concurrent data access violations (MISSING_LOCK)") Cc: Reviewed-by: Bharath SM Reviewed-by: Shyam Prasad N Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -530,6 +530,7 @@ parse_server_interfaces(struct network_i p = buf; spin_lock(&ses->iface_lock); + ses->iface_count = 0; /* * Go through iface_list and do kref_put to remove * any unused ifaces. ifaces in use will be removed @@ -650,9 +651,9 @@ parse_server_interfaces(struct network_i kref_put(&iface->refcount, release_iface); } else list_add_tail(&info->iface_head, &ses->iface_list); - spin_unlock(&ses->iface_lock); ses->iface_count++; + spin_unlock(&ses->iface_lock); ses->iface_last_update = jiffies; next_iface: nb_iface++;