aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2016-12-15 00:12:41 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-12-18 08:39:50 -0500
commit298360af3dab45659810fdc51aba0c9f4097e4f6 (patch)
tree98d46be4e77202f57ab7f36e4b245d484fa11025
parent2cf026ae85c42f253feb9f420d1b4bc99bd5503d (diff)
drivers/gpu/drm/ast: Fix infinite loop if read fails
ast_get_dram_info() 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. Fix this by erroring out if an error is detected. On powerpc systems with EEH, this leads to the device being fenced and the system continuing to operate. Cc: <stable@vger.kernel.org> # 3.10+ Signed-off-by: Russell Currey <ruscur@russell.cc> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161215051241.20815-1-ruscur@russell.cc
-rw-r--r--drivers/gpu/drm/ast/ast_main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 904beaa932d0..f75c6421db62 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -223,7 +223,8 @@ static int ast_get_dram_info(struct drm_device *dev)
223 ast_write32(ast, 0x10000, 0xfc600309); 223 ast_write32(ast, 0x10000, 0xfc600309);
224 224
225 do { 225 do {
226 ; 226 if (pci_channel_offline(dev->pdev))
227 return -EIO;
227 } while (ast_read32(ast, 0x10000) != 0x01); 228 } while (ast_read32(ast, 0x10000) != 0x01);
228 data = ast_read32(ast, 0x10004); 229 data = ast_read32(ast, 0x10004);
229 230
@@ -428,7 +429,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)
428 ast_detect_chip(dev, &need_post); 429 ast_detect_chip(dev, &need_post);
429 430
430 if (ast->chip != AST1180) { 431 if (ast->chip != AST1180) {
431 ast_get_dram_info(dev); 432 ret = ast_get_dram_info(dev);
433 if (ret)
434 goto out_free;
432 ast->vram_size = ast_get_vram_info(dev); 435 ast->vram_size = ast_get_vram_info(dev);
433 DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size); 436 DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size);
434 } 437 }