From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385557; b=5jlliyjsiILCar1zDJXYIxnqwNSW0Eybx4D6qL3Mcsc0VIIdvvueNyhPdgbRqxjMpnHh LV9pjHYMPZAalyMEHgLKiATu0Xg2IMP7m/Oc2oSy+e3QEyLClgC1qQICBRCzQKffxyngL eV8T1bwTh+EtuE4P0mALM2p1pXss9jYYTziYXJ4mugca+7IG8Zt8Eo9FFVw4BaC9zY2E+ Sk3dMpk96DaSEC0IrUxmaXmfrdLKEv0rI7eVqC/JGTUc4JMqUvR6yo8v3Gz7rKcZUSyYy xLLPD3a/JQREWeHgeC37wgd0/lzs7nQMh9JNylfSUpsiRHetm1rIdAKS2xpox+zsBpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385557; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=1L30ndG2u+TujYzJV8Z1PX2IH7sfEL1n2MuE4TviyBg=; b=t/2OWCcS2RL/4LP9I0bk+pDoHPrXc9mzC+MZHf6sqYpGHtkiKwwXLD/NvLk4RCFdNs7j Rc2zTmRCCP65SQmRR1mUt/ZveJpydVoHwcdQGkAM/py3tKRtlCBuQ3je3xBBTtqEh0A1I 5yJgrjHflhjYmPak0RoYexotL9CmfhNcUci4TVG9+yHpszuXepzKRC4JvNz7NbLnbXajn YlsrG2KjL/+rDOjZ4+0QtBBAQLXnHotpwidqiZPDJq6TK1E5ab1aqVrX80ZaAfvQOXXxj Z1IlbO3ZKPUMfdFtWX+7Qxr9Z13qQ+8BYJuMzRPccrJKX4ta62mo9qeZJr6wuvT1A5A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=sVxrfYSL; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F3D6606A32D; Fri, 4 Dec 2026 11:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=sVxrfYSL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EFA21F0092C; Fri, 4 Dec 2026 11:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385557; bh=1L30ndG2u+TujYzJV8Z1PX2IH7sfEL1n2MuE4TviyBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=sVxrfYSLthauzyCNajt5s/xvFgkFPzID3gHo8imRwrr+hBx48XTY/lyv95ioAsbU+ 59eCafZtJhMIFHHGGKRxw23pN0s3HbEkhdnR+O9k2rariEdVEhhnnyinQjJTAxXPDf qX4BSMaPCdOaj65hSde6tQa+0RCj3hmiHERdyRpA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joseph Qi , Paulo Alcantara Subject: [PATCH 6.6 0600/1167] smb: client: skip NULL channel in __cifs_put_smb_ses() Date: Fri, 4 Dec 2026 19:00:27 +0900 Message-ID: <20261204100717.683874551@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joseph Qi commit 8deaf64a59a263161dfc5128f8398fb3dcba4fac upstream. cifs_chan_skip_or_disable() clears a secondary channel's slot in the session (ses->chans[chan_index].server = NULL) without lowering chan_count when the server stops supporting multichannel. When the session is later released, __cifs_put_smb_ses() walks every slot up to chan_count and calls cifs_put_tcp_session() on it, which dereferences the server pointer immediately, so a slot left NULL by the skip path makes the release crash with a NULL pointer dereference. Clearing a slot without lowering chan_count is older than cifs_chan_skip_or_disable(): cifs_chan_update_iface() could already do the same since commit b54034a73baf9 ("cifs: during reconnect, update interface if necessary"), and the release loop has been unguarded since then. Commit 12d1e301bdfd1 ("cifs: do not let cifs_chan_update_iface deallocate channels") later removed that trigger, but the crash is reachable through it on older kernels. cifs_decrease_secondary_channels() already guards the same put with if (server). Add the same guard to the release loop so a skipped channel slot is left alone. Fixes: b54034a73baf9 ("cifs: during reconnect, update interface if necessary") Cc: stable@vger.kernel.org Signed-off-by: Joseph Qi Signed-off-by: Paulo Alcantara Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2157,7 +2157,8 @@ void __cifs_put_smb_ses(struct cifs_ses kref_put(&ses->chans[i].iface->refcount, release_iface); ses->chans[i].iface = NULL; } - cifs_put_tcp_session(ses->chans[i].server, 0); + if (ses->chans[i].server) + cifs_put_tcp_session(ses->chans[i].server, 0); ses->chans[i].server = NULL; }