]> git.baikalelectronics.ru Git - kernel.git/commit
bus: mhi: ep: Move chan->lock to the start of processing queued ch ring
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 28 Dec 2022 16:17:03 +0000 (21:47 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:31 +0000 (09:34 +0100)
commit4047bcfff03f9bf68eb1288e3c2c9f0d83145d8e
tree42e74e01203cd153856589efd73919d6fef76489
parent9206e3bee89c897ef0451db65f54efd228b3431f
bus: mhi: ep: Move chan->lock to the start of processing queued ch ring

commit 289199984ca003667af794abd5b3a7c74fe99246 upstream.

There is a good chance that while the channel ring gets processed, the STOP
or RESET command for the channel might be received from the MHI host. In
those cases, the entire channel ring processing needs to be protected by
chan->lock to prevent the race where the corresponding channel ring might
be reset.

While at it, let's also add a sanity check to make sure that the ring is
started before processing it. Because, if the STOP/RESET command gets
processed while mhi_ep_ch_ring_worker() waited for chan->lock, the ring
would've been reset.

Cc: <stable@vger.kernel.org> # 5.19
Fixes: 9dd5d0b7c99e ("bus: mhi: ep: Add support for processing channel rings")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Link: https://lore.kernel.org/r/20221228161704.255268-6-manivannan.sadhasivam@linaro.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/mhi/ep/main.c