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 F315E40841 for ; Mon, 29 Apr 2024 11:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714389990; cv=none; b=GhUSy4LEfx1OKRkhs6DWBi97d3+rCVQcTOP0MrhS0zSXEjN4yaG1IgKF4RL1e+8tToFGO1FExAtSYQnB7ztHOL4wfDVKFJZXfdXcPlEeG1vPWrwQ7SC8ZOz8P4ArAudtT5LlSeS+SNd5z+a6KJtDStqxX3tL/vHgkxOblOJycgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714389990; c=relaxed/simple; bh=/XFg3tj60EByxYMILAWL4ysJnqCGEw8g1ghJJtZP1wc=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=gID2K8NehR3Xk5sUibHqabtGVFRwT57ewhbpaapfVdEKdy2GtXasfJvxQbSVSAwoBOd+LMR8rBwinVRYgENjWlOARu02UfS6v3AnSaI+fDef+kPTJm2TOwZwRo+AUDSg1C2gcblrPNZn7Nlatosw9Oss6wiEqmbov7Fw2ro9THw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R6LlH8in; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R6LlH8in" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 356A2C113CD; Mon, 29 Apr 2024 11:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714389989; bh=/XFg3tj60EByxYMILAWL4ysJnqCGEw8g1ghJJtZP1wc=; h=Subject:To:Cc:From:Date:From; b=R6LlH8in/M2sgoVPm0kt46mVxBZ/v2QhZe1Tib9XLYsyBS+e5Hb6VomI696E/orxh MFIBnB0yhBnKlkRV0sgG1M+h7zWJ8DgTU3T7ZMooqu43OXxVccn+w4GoACX+3N5YEz H2021z13Iuf3xZLjz8KjlO+/DPim0LagZAm4BhCM= Subject: FAILED: patch "[PATCH] smb3: missing lock when picking channel" failed to apply to 5.15-stable tree To: stfrench@microsoft.com,sprasad@microsoft.com Cc: From: Date: Mon, 29 Apr 2024 13:26:15 +0200 Message-ID: <2024042915-underhand-decorator-fe82@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 8094a600245e9b28eb36a13036f202ad67c1f887 # git commit -s git send-email --to '' --in-reply-to '2024042915-underhand-decorator-fe82@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: 8094a600245e ("smb3: missing lock when picking channel") 38c8a9a52082 ("smb: move client and server files to common directory fs/smb") ea90708d3cf3 ("cifs: use the least loaded channel for sending requests") abdb1742a312 ("cifs: get rid of mount options string parsing") 9fd29a5bae6e ("cifs: use fs_context for automounts") 5dd8ce24667a ("cifs: missing directory in MAINTAINERS file") 332019e23a51 ("Merge tag '5.20-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8094a600245e9b28eb36a13036f202ad67c1f887 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 25 Apr 2024 11:30:16 -0500 Subject: [PATCH] smb3: missing lock when picking channel Coverity spotted a place where we should have been holding the channel lock when accessing the ses channel index. Addresses-Coverity: 1582039 ("Data race condition (MISSING_LOCK)") Cc: stable@vger.kernel.org Reviewed-by: Shyam Prasad N Signed-off-by: Steve French diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c index 994d70193432..e1a79e031b28 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -1057,9 +1057,11 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses) index = (uint)atomic_inc_return(&ses->chan_seq); index %= ses->chan_count; } + + server = ses->chans[index].server; spin_unlock(&ses->chan_lock); - return ses->chans[index].server; + return server; } int