diff mbox

drm/nouveau: fix oops in display destructor with headless cards

Message ID 53A03C3C.5070606@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst June 17, 2014, 1:01 p.m. UTC
If init doesn't run then disp->outp might not be initialized, resulting in an oops.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---

Comments

Ben Skeggs June 17, 2014, 1:10 p.m. UTC | #1
On Tue, Jun 17, 2014 at 11:01 PM, Maarten Lankhorst
<maarten.lankhorst@canonical.com> wrote:
> If init doesn't run then disp->outp might not be initialized, resulting in an oops.
This can't actually happen (in the very least, it's not supposed
to)... What makes you think it can?

>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
> ---
> diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/base.c b/drivers/gpu/drm/nouveau/core/engine/disp/base.c
> index c41f656abe64..9c38c5e40500 100644
> --- a/drivers/gpu/drm/nouveau/core/engine/disp/base.c
> +++ b/drivers/gpu/drm/nouveau/core/engine/disp/base.c
> @@ -99,8 +99,10 @@ _nouveau_disp_dtor(struct nouveau_object *object)
>
>         nouveau_event_destroy(&disp->vblank);
>
> -       list_for_each_entry_safe(outp, outt, &disp->outp, head) {
> -               nouveau_object_ref(NULL, (struct nouveau_object **)&outp);
> +       if (disp->outp.next) {
> +               list_for_each_entry_safe(outp, outt, &disp->outp, head) {
> +                       nouveau_object_ref(NULL, (struct nouveau_object **)&outp);
> +               }
>         }
>
>         nouveau_engine_destroy(&disp->base);
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/base.c b/drivers/gpu/drm/nouveau/core/engine/disp/base.c
index c41f656abe64..9c38c5e40500 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/base.c
@@ -99,8 +99,10 @@  _nouveau_disp_dtor(struct nouveau_object *object)
 
 	nouveau_event_destroy(&disp->vblank);
 
-	list_for_each_entry_safe(outp, outt, &disp->outp, head) {
-		nouveau_object_ref(NULL, (struct nouveau_object **)&outp);
+	if (disp->outp.next) {
+		list_for_each_entry_safe(outp, outt, &disp->outp, head) {
+			nouveau_object_ref(NULL, (struct nouveau_object **)&outp);
+		}
 	}
 
 	nouveau_engine_destroy(&disp->base);