Skip to content

Commit fd6e385

Browse files
quic-jhugoJeff Hugo
authored andcommitted
accel/qaic: Fix bootlog initialization ordering
As soon as we queue MHI buffers to receive the bootlog from the device, we could be receiving data. Therefore all the resources needed to process that data need to be setup prior to queuing the buffers. We currently initialize some of the resources after queuing the buffers which creates a race between the probe() and any data that comes back from the device. If the uninitialized resources are accessed, we could see page faults. Fix the init ordering to close the race. Fixes: 5f8df5c ("accel/qaic: Add bootlog debugfs") Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Youssef Samir <youssef.abdulrahman@oss.qualcomm.com> Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com> Reviewed-by: Carl Vanderlip <carl.vanderlip@oss.qualcomm.com> Signed-off-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com> Link: https://lore.kernel.org/r/20251007115750.332169-1-youssef.abdulrahman@oss.qualcomm.com
1 parent 48a7107 commit fd6e385

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/accel/qaic/qaic_debugfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d
218218
if (ret)
219219
goto destroy_workqueue;
220220

221+
dev_set_drvdata(&mhi_dev->dev, qdev);
222+
qdev->bootlog_ch = mhi_dev;
223+
221224
for (i = 0; i < BOOTLOG_POOL_SIZE; i++) {
222225
msg = devm_kzalloc(&qdev->pdev->dev, sizeof(*msg), GFP_KERNEL);
223226
if (!msg) {
@@ -233,8 +236,6 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d
233236
goto mhi_unprepare;
234237
}
235238

236-
dev_set_drvdata(&mhi_dev->dev, qdev);
237-
qdev->bootlog_ch = mhi_dev;
238239
return 0;
239240

240241
mhi_unprepare:

0 commit comments

Comments
 (0)