From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 86FDC3E1681; Wed, 30 Sep 2026 19:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790796500; cv=none; b=Vo+ILhYmReES+abTLxqFbkUI1Msgj/5YqxrZahmMLB/bTdGqaz6vXjh6zVWO0FFW+pvIFKWZraqOe5WGs0r7dV0t2rwNjyQawwqmCkh1wEnTZ7jl95FdailibrehCLnIB1ty0JH+eFWo6nMZmiDV7hU52CPj1r/VNc6QOpoPdiI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790796500; c=relaxed/simple; bh=kL4Sm5JFphJ4rdOjsdp5AOQ9pgow7UpntTxnhEup77s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L/YFA0bJPPzB+pnfU9ZDhq4KsWUVKTasp149B4jQ1TPKWBrRbJ9JUz4PmhwJpyllN/H+jN4rKvBJpbktBbcoPHLxgpM5dJluPDaXtMFp0QwGo6yfEPPYXCx3sZSO7liE2rTJ1rBTIqw2o0ysVXcCvqJ9rrVNORviICMI8eFxwY4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O9hEKb3H; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O9hEKb3H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE721F000FF; Wed, 30 Sep 2026 19:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790796499; bh=d9rRVApvRBo2gqy7Q3iZ6rlfed/jHyszUuk1CHVtEO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=O9hEKb3HSgo4iX9O7cUenSlhF0hoG1zCFjs2tw3SNxN8wC0azHYnirjMiU/eKWw63 PRgrW5VkHaNxhtm47DlpHqKBWBi8MPVu056Lqyj3Jam/SzJ0Catv2JrTvqrUU9sr5W kZ/rPblyetpDfzCN989h815/GEWv7V4xgka68MoE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Namjae Jeon , Paulo Alcantara , David Howells , Shyam Prasad N , Ronnie Sahlberg , Tom Talpey , Bharath SM Subject: [PATCH 6.6 0934/1193] smb: client: fix rlist race and missing initialization Date: Wed, 30 Sep 2026 17:26:58 +0200 Message-ID: <20260930152454.993908783@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152434.301151190@linuxfoundation.org> References: <20260930152434.301151190@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paulo Alcantara commit 5f270f091256da1338c3631083e15d7f83cc05e1 upstream. TCP_Server_Info.rlist is allocated via kzalloc which zeros both ->next and ->prev to NULL instead of pointing to itself, making list_empty() always return false and list_add() dereference a NULL ->prev pointer. Also, cifs_signal_cifsd_for_reconnect() can be called concurrently from multiple cifsd threads, allowing the same server's rlist node to be added twice into the local list, corrupting it. Closes: https://sashiko.dev/#/patchset/20260911204446.1719356-1-pc%40manguebit.org Fixes: df0e03a4fb94 ("smb: client: fix potential deadlock when reconnecting channels") Reviewed-by: Namjae Jeon Signed-off-by: Paulo Alcantara Cc: David Howells Cc: Shyam Prasad N Cc: Ronnie Sahlberg Cc: Tom Talpey Cc: Bharath SM Cc: Namjae Jeon Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/smb/client/connect.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -187,6 +187,8 @@ cifs_signal_cifsd_for_reconnect(struct T nserver = ses->chans[i].server; if (!nserver) continue; + if (!list_empty(&nserver->rlist)) + continue; nserver->srv_count++; list_add(&nserver->rlist, &reco); } @@ -195,11 +197,15 @@ cifs_signal_cifsd_for_reconnect(struct T } } + spin_lock(&cifs_tcp_ses_lock); list_for_each_entry_safe(server, nserver, &reco, rlist) { list_del_init(&server->rlist); set_need_reco(server); + spin_unlock(&cifs_tcp_ses_lock); cifs_put_tcp_session(server, 0); + spin_lock(&cifs_tcp_ses_lock); } + spin_unlock(&cifs_tcp_ses_lock); } /* @@ -1784,6 +1790,7 @@ cifs_get_tcp_session(struct smb3_fs_cont spin_lock_init(&tcp_ses->mid_lock); INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); INIT_LIST_HEAD(&tcp_ses->smb_ses_list); + INIT_LIST_HEAD(&tcp_ses->rlist); INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server); mutex_init(&tcp_ses->reconnect_mutex);