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 1BBBC346A0C; Tue, 21 Jul 2026 20:37:34 +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=1784666255; cv=none; b=nXDt+VFTPLdAdRv5azta+UsV7SH/O12t4NsFokM2tJK7KcgFji2NXm8swsdN0fgp4F21ydfqrN8MLv8l1/z6hq9TiTD7YXDnATCf6l3zljIZf1AxlZjpPVDgdk46JjSWFOrD6sbuY1hBi+z+BhmxWWlwzd/TvvCNb/RBmiY6Zd8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784666255; c=relaxed/simple; bh=tvwJITORavqiNVG1ifPdn7mvIokA5rymaJnC/h4Cglk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U0nUv66v8bpLJKXVRz9hL3c9qpP272c3GnGj1wNa9UQ3P6PZ9LMLryUwm5rI/l3i4hBW6/qgRlEHVClw9y9kijMW35Z+Wc8jFwwGbRLmL11KyC6qhm+e8atq3n10EYdNpzJyGzoMzEpXXVCsHAXp/zCDi0CBxiQyyTWsgOzw21o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Be8Q9tJ5; 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="Be8Q9tJ5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CA641F000E9; Tue, 21 Jul 2026 20:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784666253; bh=xrVZv04umntK9tUpWTPApX0WmqTcRoT9er7fFUIlGNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Be8Q9tJ5Ch/Cp5NaWekh2ZKLfJ4IkAXbmSj9MjdUnHcb+MxW4WPT0gu87rzIvOVRd xx3r1KMtKVNaLwQQ/oXtdM/DtyabtOLix8w4athPrmhqXCJpZl0Zc0DitQ4Iv7OLs2 u6m76tPd57YvFQqPFpc8PKAUJ9bOXUuImk0WjxbE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sumit Kumar , Manivannan Sadhasivam , Sasha Levin Subject: [PATCH 6.6 0614/1266] bus: mhi: ep: Fix potential deadlock in mhi_ep_reset_worker() Date: Tue, 21 Jul 2026 17:17:31 +0200 Message-ID: <20260721152455.600948775@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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: Sumit Kumar [ Upstream commit 9dece4435d396e9877e27483552b910ba8654169 ] There is a potential deadlock scenario in mhi_ep_reset_worker() where the state_lock mutex is acquired twice in the same call chain: mhi_ep_reset_worker() mutex_lock(&mhi_cntrl->state_lock) mhi_ep_power_up() mhi_ep_set_ready_state() mutex_lock(&mhi_cntrl->state_lock) <- Deadlock Fix this by releasing the state_lock before calling mhi_ep_power_up(). The lock is only needed to protect current MHI state read operation. The lock can be safely released before proceeding with the power up sequence. Fixes: 7a97b6b47353 ("bus: mhi: ep: Add support for handling MHI_RESET") Signed-off-by: Sumit Kumar Signed-off-by: Manivannan Sadhasivam Link: https://patch.msgid.link/20260414-reset_worker_deadlock-v2-1-42fd682b45db@oss.qualcomm.com Signed-off-by: Sasha Levin --- drivers/bus/mhi/ep/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c index 558cfb3a06c5ea..821c8101ec64da 100644 --- a/drivers/bus/mhi/ep/main.c +++ b/drivers/bus/mhi/ep/main.c @@ -1071,11 +1071,12 @@ static void mhi_ep_reset_worker(struct work_struct *work) mhi_ep_power_down(mhi_cntrl); - mutex_lock(&mhi_cntrl->state_lock); - /* Reset MMIO to signal host that the MHI_RESET is completed in endpoint */ mhi_ep_mmio_reset(mhi_cntrl); + + mutex_lock(&mhi_cntrl->state_lock); cur_state = mhi_cntrl->mhi_state; + mutex_unlock(&mhi_cntrl->state_lock); /* * Only proceed further if the reset is due to SYS_ERR. The host will @@ -1084,8 +1085,6 @@ static void mhi_ep_reset_worker(struct work_struct *work) */ if (cur_state == MHI_STATE_SYS_ERR) mhi_ep_power_up(mhi_cntrl); - - mutex_unlock(&mhi_cntrl->state_lock); } /* -- 2.53.0