* [PATCH] drivers/gpu/drm/ast: Fix infinite loop if read fails
@ 2020-12-28 2:27 Defang Bo
0 siblings, 0 replies; only message in thread
From: Defang Bo @ 2020-12-28 2:27 UTC (permalink / raw)
To: airlied, tzimmermann, airlied, daniel; +Cc: dri-devel, linux-kernel, Defang Bo
[Why]
Similar to commit <298360af3>("drivers/gpu/drm/ast: Fix infinite loop if read fails"),
ast_init_dram_reg() configures a window in order to access BMC memory.
A BMC register can be configured to disallow this, and if so, causes
an infinite loop in the ast driver which renders the system unusable.
[How]
Fix this by erroring out if an error is detected.
Signed-off-by: Defang Bo <bodefang@126.com>
---
drivers/gpu/drm/ast/ast_post.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index 8902c2f..8bcd1e6 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -287,7 +287,8 @@ static void ast_init_dram_reg(struct drm_device *dev)
ast_write32(ast, 0x10100, 0xa8);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return;
} while (ast_read32(ast, 0x10100) != 0xa8);
} else {/* AST2100/1100 */
if (ast->chip == AST2100 || ast->chip == 2200)
@@ -299,12 +300,14 @@ static void ast_init_dram_reg(struct drm_device *dev)
ast_write32(ast, 0xf000, 0x1);
ast_write32(ast, 0x12000, 0x1688A8A8);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return;
} while (ast_read32(ast, 0x12000) != 0x01);
ast_write32(ast, 0x10000, 0xfc600309);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return;
} while (ast_read32(ast, 0x10000) != 0x01);
}
--
2.7.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-28 11:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 2:27 [PATCH] drivers/gpu/drm/ast: Fix infinite loop if read fails Defang Bo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®