From: jsg Date: Mon, 9 Sep 2024 08:18:38 +0000 (+0000) Subject: drm/fb-helper: Don't schedule_work() to flush frame buffer during panic() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=61e353b93e080559c59c1e11498bd378adf8bb5e;p=openbsd drm/fb-helper: Don't schedule_work() to flush frame buffer during panic() From Qiuxu Zhuo d5618eaea8868e2534c375b8a512693658068cf8 in linux-6.6.y/6.6.50 833cd3e9ad8360785b6c23c82dd3856df00732d9 in mainline linux --- diff --git a/sys/dev/pci/drm/drm_fb_helper.c b/sys/dev/pci/drm/drm_fb_helper.c index 1a0be9cb24e..18a9d1def98 100644 --- a/sys/dev/pci/drm/drm_fb_helper.c +++ b/sys/dev/pci/drm/drm_fb_helper.c @@ -647,6 +647,17 @@ static void drm_fb_helper_add_damage_clip(struct drm_fb_helper *helper, u32 x, u static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y, u32 width, u32 height) { + /* + * This function may be invoked by panic() to flush the frame + * buffer, where all CPUs except the panic CPU are stopped. + * During the following schedule_work(), the panic CPU needs + * the worker_pool lock, which might be held by a stopped CPU, + * causing schedule_work() and panic() to block. Return early on + * oops_in_progress to prevent this blocking. + */ + if (oops_in_progress) + return; + drm_fb_helper_add_damage_clip(helper, x, y, width, height); schedule_work(&helper->damage_work);