Skip to content

Commit 646868e

Browse files
quic-jhugogregkh
authored andcommitted
accel/qaic: Fix bootlog initialization ordering
[ Upstream commit fd6e385 ] 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 <[email protected]> Signed-off-by: Youssef Samir <[email protected]> Reviewed-by: Jeff Hugo <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Jeff Hugo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent e15f6ac commit 646868e

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
@@ -251,6 +251,9 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d
251251
if (ret)
252252
goto destroy_workqueue;
253253

254+
dev_set_drvdata(&mhi_dev->dev, qdev);
255+
qdev->bootlog_ch = mhi_dev;
256+
254257
for (i = 0; i < BOOTLOG_POOL_SIZE; i++) {
255258
msg = devm_kzalloc(&qdev->pdev->dev, sizeof(*msg), GFP_KERNEL);
256259
if (!msg) {
@@ -266,8 +269,6 @@ static int qaic_bootlog_mhi_probe(struct mhi_device *mhi_dev, const struct mhi_d
266269
goto mhi_unprepare;
267270
}
268271

269-
dev_set_drvdata(&mhi_dev->dev, qdev);
270-
qdev->bootlog_ch = mhi_dev;
271272
return 0;
272273

273274
mhi_unprepare:

0 commit comments

Comments
 (0)