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 DC9E42375B for ; Mon, 29 Apr 2024 11:26:32 +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=1714389992; cv=none; b=nqn8Uaur03vW485mUOTji+v77HLllQXXDNVrHGKPHzBfZb3KYJmqudRP8JUTbtAmQQzPYWUnO+4ePxFx/HBQCTd9J2AJosSMTWwvVGNHGgHBDKNDZ1D+0azC4k/FQpfdtTg7bbpeHJXbN8doBax3Xa61njBCXXV9/26/J1Qo0P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714389992; c=relaxed/simple; bh=Q2LxNfoatb1uHZ1InxrTb0eJNbyyocGPOYI8Z9rt2QU=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=dytNlWu5wbTzXGROy0QxUsXOOBRcJbKIDzspsXXGuoRrd/FL61ijYcqcdG8HkyvcA4DsEiyBEeNlmRheTgu6NjmerX83M4Gy/Wndiv1E8mKyiwJog6hBmGcDD19JMWGPVJrbKRuOnpNhGTRetzynuR5xWwNMyVApmPWGK49QfEg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VCEHWBCl; 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="VCEHWBCl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 646FEC113CD; Mon, 29 Apr 2024 11:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714389992; bh=Q2LxNfoatb1uHZ1InxrTb0eJNbyyocGPOYI8Z9rt2QU=; h=Subject:To:Cc:From:Date:From; b=VCEHWBCldXBFetYgkCV72LXtdY4nDkgGkSGwhoMMOkXOYmbds6WO3miwxRxAFbkf6 LZkwVPRWm+/owsjv8SC5UzPwJ/QlV/SJl7YDtNt4DEDNmyGemgjOaFgmWlauWUI/Kh 3uyUyKH5DWwzr/ZLpS/teJHn6KGyHJESzvBS6gqU= Subject: FAILED: patch "[PATCH] smb3: missing lock when picking channel" failed to apply to 5.4-stable tree To: stfrench@microsoft.com,sprasad@microsoft.com Cc: From: Date: Mon, 29 Apr 2024 13:26:16 +0200 Message-ID: <2024042916-rebate-duct-2b7b@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.4-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.4.y git checkout FETCH_HEAD git cherry-pick -x 8094a600245e9b28eb36a13036f202ad67c1f887 # git commit -s git send-email --to '' --in-reply-to '2024042916-rebate-duct-2b7b@gregkh' --subject-prefix 'PATCH 5.4.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