]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bus: mhi: host: Fix race between channel preparation and M0 event
authorQiang Yu <quic_qianyu@quicinc.com>
Sun, 16 Oct 2022 03:05:32 +0000 (11:05 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jan 2023 10:11:54 +0000 (11:11 +0100)
commit0a1129c4b445e1a2b82c915c5cd932442539b2fc
treebb5083e829e213d10c0ca32fd0c1922621f84945
parent878d15dd43bcb2d7d9f807b0cc57ece7d23c7e29
bus: mhi: host: Fix race between channel preparation and M0 event

commit 869a99907faea6d1835b0bd0d0422ae3519c6ea9 upstream.

There is a race condition where mhi_prepare_channel() updates the
read and write pointers as the base address and in parallel, if
an M0 transition occurs, the tasklet goes ahead and rings
doorbells for all channels with a delta in TRE rings assuming
they are already enabled. This causes a null pointer access. Fix
it by adding a channel enabled check before ringing channel
doorbells.

Cc: stable@vger.kernel.org # 5.19
Fixes: a6e2e3522f29 "bus: mhi: core: Add support for PM state transitions"
Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://lore.kernel.org/r/1665889532-13634-1-git-send-email-quic_qianyu@quicinc.com
[mani: CCed stable list]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/mhi/host/pm.c