drm/nouveau: reorder nouveau_drm_device_fini
Subsystems (3)
PATCH v2 1/1 drm/nouveau: reorder nouveau_drm_device_fini
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 makes output poll workers cleared right before fbcon resources are destroyed.
BUG: KASAN: use-after-free in __drm_fb_helper_initial_config_and_unlock.cold+0x1f3/0x291
[drm_kms_helper]
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/nouveau/nouveau_fbcon.c +2 -0
@@ -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);
Signature · 1 line
2.32.0
So I think you forgot to update the subject of the patch. If you can send a respin of this patch with a corrected patch title, then you can consider this:
I'll push once you get the respin out
Quoted 46 lines · Mark Menzynski
Resources needed for output poll workers are destroyed in
nouveau_fbcon_fini()before output poll workers are cleared innouveau_display_fini(). This means there is a time betweenfbcon_fini()anddisplay_fini(), where if output poll happens, it crashes.This makes output poll workers cleared right 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 <[email protected]>Cc Karol Herbst <[email protected]>Cc Lyude Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Mark Menzynski <[email protected]>---
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 ++1 file changed, 2 insertions(+)drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0@@ -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>drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0@@ -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);
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
So I think you forgot to update the subject of the patch. If you can send a respin of this patch with a corrected patch title, then you can consider this:
I'll push once you get the respin out
Quoted 46 lines · Mark Menzynski
Resources needed for output poll workers are destroyed in
nouveau_fbcon_fini()before output poll workers are cleared innouveau_display_fini(). This means there is a time betweenfbcon_fini()anddisplay_fini(), where if output poll happens, it crashes.This makes output poll workers cleared right 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 <[email protected]>Cc Karol Herbst <[email protected]>Cc Lyude Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Mark Menzynski <[email protected]>---
drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 ++1 file changed, 2 insertions(+)drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0@@ -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>drivers/gpu/drm/nouveau/nouveau_fbcon.c +0
-0@@ -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);
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat