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 1F8942375B for ; Mon, 29 Apr 2024 11:26:41 +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=1714390001; cv=none; b=DtHG452Dt0M8UT/g5qMbwa1+uRHF3Uyu+lME8VCVzhbDJvNT1V3R35P9cLDXWDbQAFXL+SmrMs2McnyViW00IRd9FAyt+Fr1W19SYXTycelaHBFCgpiADksGndbyWgKeJVpL9CYqm4ziWqbxgovwyCukdSWKMvusAQRBUHvJwJo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714390001; c=relaxed/simple; bh=tfjhM84T/BT6fF7gUpoEaorgC9XS1J1t2BskmVnAV68=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=qbC6a1XSEdr1Rrk55zOgfQJhzr6WXy+HZOFHL5/x7tg7sJG8otKMqwxO8YnAHsEsP2adnZZ0XFwlKUJruKPiuxF+9qfTwZixRCjeKbGJKhc+hnCU6ufnApyRwaKTSMz0Fjni9Sp+JNXYFbpBl4Wo7uXppWVvaRUFAnsMe2QcILY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fXa6kD5F; 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="fXa6kD5F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BBA7C113CD; Mon, 29 Apr 2024 11:26:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714390001; bh=tfjhM84T/BT6fF7gUpoEaorgC9XS1J1t2BskmVnAV68=; h=Subject:To:Cc:From:Date:From; b=fXa6kD5FU9KNKAeFFlY2dETwxlEJJTtd5aqP/rftKJdFdr5lxfRt6qr2F1foM5aX4 yPZFbtqmSGNrOxH4O6LWXQamedRYPPKhd8LfQlLOPzHKI5szAL3bd2qGMHjp4xTmR9 724TfuMJZ/HPiIE5t1LrD0YuW7emlb+2r6WQjMuI= Subject: FAILED: patch "[PATCH] smb3: fix lock ordering potential deadlock in" failed to apply to 5.15-stable tree To: stfrench@microsoft.com,sprasad@microsoft.com Cc: From: Date: Mon, 29 Apr 2024 13:26:29 +0200 Message-ID: <2024042929-repave-emerald-63ea@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 8861fd5180476f45f9e8853db154600469a0284f # git commit -s git send-email --to '' --in-reply-to '2024042929-repave-emerald-63ea@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: 8861fd518047 ("smb3: fix lock ordering potential deadlock in cifs_sync_mid_result") 38c8a9a52082 ("smb: move client and server files to common directory fs/smb") 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 8861fd5180476f45f9e8853db154600469a0284f Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 25 Apr 2024 12:49:50 -0500 Subject: [PATCH] smb3: fix lock ordering potential deadlock in cifs_sync_mid_result Coverity spotted that the cifs_sync_mid_result function could deadlock "Thread deadlock (ORDER_REVERSAL) lock_order: Calling spin_lock acquires lock TCP_Server_Info.srv_lock while holding lock TCP_Server_Info.mid_lock" Addresses-Coverity: 1590401 ("Thread deadlock (ORDER_REVERSAL)") 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 e1a79e031b28..ddf1a3aafee5 100644 --- a/fs/smb/client/transport.c +++ b/fs/smb/client/transport.c @@ -909,12 +909,15 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) list_del_init(&mid->qhead); mid->mid_flags |= MID_DELETED; } + spin_unlock(&server->mid_lock); cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n", __func__, mid->mid, mid->mid_state); rc = -EIO; + goto sync_mid_done; } spin_unlock(&server->mid_lock); +sync_mid_done: release_mid(mid); return rc; }