* [PATCH 1/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
@ 2020-12-25 8:13 ` Defang Bo
0 siblings, 0 replies; 6+ messages in thread
From: Defang Bo @ 2020-12-25 8:13 UTC (permalink / raw)
To: airlied, daniel; +Cc: dri-devel, linux-kernel, Defang Bo
[Why] Similar to commit <298360af3> 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 | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index 8902c2f..ef19c70 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -287,7 +287,9 @@ static void ast_init_dram_reg(struct drm_device *dev)
ast_write32(ast, 0x10100, 0xa8);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return -EIO;
+
} while (ast_read32(ast, 0x10100) != 0xa8);
} else {/* AST2100/1100 */
if (ast->chip == AST2100 || ast->chip == 2200)
@@ -299,12 +301,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 -EIO;
} while (ast_read32(ast, 0x12000) != 0x01);
ast_write32(ast, 0x10000, 0xfc600309);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return -EIO;
} while (ast_read32(ast, 0x10000) != 0x01);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
@ 2020-12-25 8:13 ` Defang Bo
0 siblings, 0 replies; 6+ messages in thread
From: Defang Bo @ 2020-12-25 8:13 UTC (permalink / raw)
To: airlied, daniel; +Cc: Defang Bo, linux-kernel, dri-devel
[Why] Similar to commit <298360af3> 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 | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index 8902c2f..ef19c70 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -287,7 +287,9 @@ static void ast_init_dram_reg(struct drm_device *dev)
ast_write32(ast, 0x10100, 0xa8);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return -EIO;
+
} while (ast_read32(ast, 0x10100) != 0xa8);
} else {/* AST2100/1100 */
if (ast->chip == AST2100 || ast->chip == 2200)
@@ -299,12 +301,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 -EIO;
} while (ast_read32(ast, 0x12000) != 0x01);
ast_write32(ast, 0x10000, 0xfc600309);
do {
- ;
+ if (pci_channel_offline(dev->pdev))
+ return -EIO;
} while (ast_read32(ast, 0x10000) != 0x01);
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
2020-12-25 8:13 ` Defang Bo
@ 2020-12-25 8:13 ` Defang Bo
-1 siblings, 0 replies; 6+ messages in thread
From: Defang Bo @ 2020-12-25 8:13 UTC (permalink / raw)
To: airlied, daniel; +Cc: dri-devel, linux-kernel, Defang Bo
[Why] Similar to commit <298360af3> 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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index ef19c70..86e4d23 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -302,13 +302,13 @@ static void ast_init_dram_reg(struct drm_device *dev)
ast_write32(ast, 0x12000, 0x1688A8A8);
do {
if (pci_channel_offline(dev->pdev))
- return -EIO;
+ return -EIO;
} while (ast_read32(ast, 0x12000) != 0x01);
ast_write32(ast, 0x10000, 0xfc600309);
do {
if (pci_channel_offline(dev->pdev))
- return -EIO;
+ return -EIO;
} while (ast_read32(ast, 0x10000) != 0x01);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
@ 2020-12-25 8:13 ` Defang Bo
0 siblings, 0 replies; 6+ messages in thread
From: Defang Bo @ 2020-12-25 8:13 UTC (permalink / raw)
To: airlied, daniel; +Cc: Defang Bo, linux-kernel, dri-devel
[Why] Similar to commit <298360af3> 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 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
index ef19c70..86e4d23 100644
--- a/drivers/gpu/drm/ast/ast_post.c
+++ b/drivers/gpu/drm/ast/ast_post.c
@@ -302,13 +302,13 @@ static void ast_init_dram_reg(struct drm_device *dev)
ast_write32(ast, 0x12000, 0x1688A8A8);
do {
if (pci_channel_offline(dev->pdev))
- return -EIO;
+ return -EIO;
} while (ast_read32(ast, 0x12000) != 0x01);
ast_write32(ast, 0x10000, 0xfc600309);
do {
if (pci_channel_offline(dev->pdev))
- return -EIO;
+ return -EIO;
} while (ast_read32(ast, 0x10000) != 0x01);
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
2020-12-25 8:13 ` Defang Bo
@ 2020-12-25 16:47 ` Randy Dunlap
-1 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2020-12-25 16:47 UTC (permalink / raw)
To: Defang Bo, airlied, daniel; +Cc: dri-devel, linux-kernel
On 12/25/20 12:13 AM, Defang Bo wrote:
> [Why] Similar to commit <298360af3> 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.
Hm, it appears that all this patch does is change spaces to tabs...
> Signed-off-by: Defang Bo <bodefang@126.com>
> ---
> drivers/gpu/drm/ast/ast_post.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
> index ef19c70..86e4d23 100644
> --- a/drivers/gpu/drm/ast/ast_post.c
> +++ b/drivers/gpu/drm/ast/ast_post.c
> @@ -302,13 +302,13 @@ static void ast_init_dram_reg(struct drm_device *dev)
> ast_write32(ast, 0x12000, 0x1688A8A8);
> do {
> if (pci_channel_offline(dev->pdev))
> - return -EIO;
> + return -EIO;
> } while (ast_read32(ast, 0x12000) != 0x01);
>
> ast_write32(ast, 0x10000, 0xfc600309);
> do {
> if (pci_channel_offline(dev->pdev))
> - return -EIO;
> + return -EIO;
> } while (ast_read32(ast, 0x10000) != 0x01);
> }
>
>
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drivers/gpu/drm/ast: Fix infinite loop if read fails
@ 2020-12-25 16:47 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2020-12-25 16:47 UTC (permalink / raw)
To: Defang Bo, airlied, daniel; +Cc: linux-kernel, dri-devel
On 12/25/20 12:13 AM, Defang Bo wrote:
> [Why] Similar to commit <298360af3> 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.
Hm, it appears that all this patch does is change spaces to tabs...
> Signed-off-by: Defang Bo <bodefang@126.com>
> ---
> drivers/gpu/drm/ast/ast_post.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_post.c b/drivers/gpu/drm/ast/ast_post.c
> index ef19c70..86e4d23 100644
> --- a/drivers/gpu/drm/ast/ast_post.c
> +++ b/drivers/gpu/drm/ast/ast_post.c
> @@ -302,13 +302,13 @@ static void ast_init_dram_reg(struct drm_device *dev)
> ast_write32(ast, 0x12000, 0x1688A8A8);
> do {
> if (pci_channel_offline(dev->pdev))
> - return -EIO;
> + return -EIO;
> } while (ast_read32(ast, 0x12000) != 0x01);
>
> ast_write32(ast, 0x10000, 0xfc600309);
> do {
> if (pci_channel_offline(dev->pdev))
> - return -EIO;
> + return -EIO;
> } while (ast_read32(ast, 0x10000) != 0x01);
> }
>
>
--
~Randy
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-28 10:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25 8:13 [PATCH 1/2] drivers/gpu/drm/ast: Fix infinite loop if read fails Defang Bo
2020-12-25 8:13 ` Defang Bo
2020-12-25 8:13 ` [PATCH 2/2] " Defang Bo
2020-12-25 8:13 ` Defang Bo
2020-12-25 16:47 ` Randy Dunlap
2020-12-25 16:47 ` Randy Dunlap
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.