From c73263ced1810a3b73c0325d050f44622782398b Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 23 Aug 2021 21:52:35 -0700 Subject: [PATCH] Make sure CRTCs have associated fbs before setting them In replacefb we need to make sure each CRTC we replace the fb on has one, or we'll dereference a bogus pointer. --- linux-core/drm_crtc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index c011db3..62755b7 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -2576,7 +2576,7 @@ int drm_mode_replacefb(struct drm_device *dev, /* find all crtcs connected to this fb */ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - if (crtc->fb->id == r->buffer_id) { + if (crtc->fb && crtc->fb->id == r->buffer_id) { crtc->funcs->mode_set_base(crtc, crtc->x, crtc->y); } } -- 1.5.4.1