Commit 3720b3a
committed
bus: mhi: host: Fix race between unprepare and queue_buf
JIRA: https://issues.redhat.com/browse/RHEL-93880
commit 0686a81
Author: Jeffrey Hugo <quic_jhugo@quicinc.com>
Date: Thu Mar 6 10:29:13 2025 -0700
bus: mhi: host: Fix race between unprepare and queue_buf
A client driver may use mhi_unprepare_from_transfer() to quiesce
incoming data during the client driver's tear down. The client driver
might also be processing data at the same time, resulting in a call to
mhi_queue_buf() which will invoke mhi_gen_tre(). If mhi_gen_tre() runs
after mhi_unprepare_from_transfer() has torn down the channel, a panic
will occur due to an invalid dereference leading to a page fault.
This occurs because mhi_gen_tre() does not verify the channel state
after locking it. Fix this by having mhi_gen_tre() confirm the channel
state is valid, or return error to avoid accessing deinitialized data.
Cc: stable@vger.kernel.org # 6.8
Fixes: b89b6a8 ("bus: mhi: host: Add spinlock to protect WP access when queueing TREs")
Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Reviewed-by: Youssef Samir <quic_yabdulra@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Troy Hanson <quic_thanson@quicinc.com>
Link: https://lore.kernel.org/r/20250306172913.856982-1-jeff.hugo@oss.qualcomm.com
[mani: added stable tag]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@redhat.com>1 parent f0f6d24 commit 3720b3a
1 file changed
+10
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1188 | 1188 | | |
1189 | 1189 | | |
1190 | 1190 | | |
1191 | | - | |
| 1191 | + | |
1192 | 1192 | | |
1193 | 1193 | | |
1194 | 1194 | | |
1195 | 1195 | | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1196 | 1201 | | |
1197 | 1202 | | |
1198 | 1203 | | |
| |||
1210 | 1215 | | |
1211 | 1216 | | |
1212 | 1217 | | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
| 1218 | + | |
| 1219 | + | |
1217 | 1220 | | |
1218 | 1221 | | |
1219 | 1222 | | |
| |||
1231 | 1234 | | |
1232 | 1235 | | |
1233 | 1236 | | |
| 1237 | + | |
1234 | 1238 | | |
1235 | 1239 | | |
1236 | | - | |
| 1240 | + | |
1237 | 1241 | | |
1238 | 1242 | | |
1239 | 1243 | | |
| |||
0 commit comments