]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bus: mhi: ep: Protect mhi_ep_handle_syserr() in the error path
authorManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Mon, 2 Mar 2026 08:56:12 +0000 (14:26 +0530)
committerManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Tue, 12 May 2026 14:33:57 +0000 (20:03 +0530)
All the callers of mhi_ep_handle_syserr() except mhi_ep_process_cmd_ring()
are holding the 'state_lock' to avoid the race in setting the MHI state. So
do the same in mhi_ep_process_cmd_ring() for sanity.

Fixes: e827569062a8 ("bus: mhi: ep: Add support for processing command rings")
Cc: stable@vger.kernel.org # 5.18
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260302085612.18725-1-manivannan.sadhasivam@oss.qualcomm.com
drivers/bus/mhi/ep/main.c

index 5330b03dc6369c68260fa61f5c6e0b7a0186607e..9db2a2a2c9134542a96539c06c0377605be86b93 100644 (file)
@@ -232,7 +232,9 @@ static int mhi_ep_process_cmd_ring(struct mhi_ep_ring *ring, struct mhi_ring_ele
                        ret = mhi_ep_create_device(mhi_cntrl, ch_id);
                        if (ret) {
                                dev_err(dev, "Error creating device for channel (%u)\n", ch_id);
+                               mutex_lock(&mhi_cntrl->state_lock);
                                mhi_ep_handle_syserr(mhi_cntrl);
+                               mutex_unlock(&mhi_cntrl->state_lock);
                                return ret;
                        }
                }