drm/nouveau/disp: fix use-after-free in error handling of nouveau_connector_create
authorKarol Herbst <kherbst@redhat.com>
Mon, 14 Aug 2023 14:49:32 +0000 (16:49 +0200)
committerKarol Herbst <kherbst@redhat.com>
Wed, 16 Aug 2023 21:45:04 +0000 (23:45 +0200)
commit1b254b791d7b7dea6e8adc887fbbd51746d8bb27
tree119d1dcb552884be53497315e931f8cdd2b879c9
parent96d3c1cadedb6ae2e8965e19cd12caa244afbd9c
drm/nouveau/disp: fix use-after-free in error handling of nouveau_connector_create

We can't simply free the connector after calling drm_connector_init on it.
We need to clean up the drm side first.

It might not fix all regressions from commit 2b5d1c29f6c4
("drm/nouveau/disp: PIOR DP uses GPIO for HPD, not PMGR AUX interrupts"),
but at least it fixes a memory corruption in error handling related to
that commit.

Link: https://lore.kernel.org/lkml/20230806213107.GFZNARG6moWpFuSJ9W@fat_crate.local/
Fixes: 95983aea8003 ("drm/nouveau/disp: add connector class")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230814144933.3956959-1-kherbst@redhat.com
drivers/gpu/drm/nouveau/nouveau_connector.c