]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/nouveau: clear output poll workers before nouveau_fbcon_destroy()
authorMark Menzynski <mmenzyns@redhat.com>
Mon, 23 May 2022 11:35:41 +0000 (13:35 +0200)
committerLyude Paul <lyude@redhat.com>
Mon, 23 May 2022 18:37:27 +0000 (14:37 -0400)
Resources needed for output poll workers are destroyed in
nouveau_fbcon_fini() before output poll workers are cleared in
nouveau_display_fini(). This means there is a time between fbcon_fini()
and display_fini(), where if output poll happens, it crashes.

This patch introduces another output poll clearing before fbcon
resources are destroyed.

BUG: KASAN: use-after-free in
__drm_fb_helper_initial_config_and_unlock.cold+0x1f3/0x291
[drm_kms_helper]

Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Menzynski <mmenzyns@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220523113541.10562-1-mmenzyns@redhat.com
drivers/gpu/drm/nouveau/nouveau_fbcon.c

index 4f9b3aa5deda9942d2759df40d44751f31e7ecc4..5226323e55d34b93c1aabeabfaa3ddbf6c183c1c 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_atomic.h>
@@ -605,6 +606,7 @@ nouveau_fbcon_fini(struct drm_device *dev)
        if (!drm->fbcon)
                return;
 
+       drm_kms_helper_poll_fini(dev);
        nouveau_fbcon_accel_fini(dev);
        nouveau_fbcon_destroy(dev, drm->fbcon);
        kfree(drm->fbcon);