Commit a77955f
bus: mhi: host: Fix race between unprepare and queue_buf
commit 0686a81 upstream.
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 7d12a7d commit a77955f
1 file changed
+10
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
1210 | | - | |
| 1210 | + | |
1211 | 1211 | | |
1212 | 1212 | | |
1213 | 1213 | | |
1214 | 1214 | | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1215 | 1220 | | |
1216 | 1221 | | |
1217 | 1222 | | |
| |||
1229 | 1234 | | |
1230 | 1235 | | |
1231 | 1236 | | |
1232 | | - | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
| 1237 | + | |
| 1238 | + | |
1236 | 1239 | | |
1237 | 1240 | | |
1238 | 1241 | | |
| |||
1250 | 1253 | | |
1251 | 1254 | | |
1252 | 1255 | | |
| 1256 | + | |
1253 | 1257 | | |
1254 | 1258 | | |
1255 | | - | |
| 1259 | + | |
1256 | 1260 | | |
1257 | 1261 | | |
1258 | 1262 | | |
| |||
0 commit comments