From: Dingchen Zhang Date: Fri, 26 Jul 2019 17:37:43 +0000 (-0400) Subject: drm: Set crc->opened to false before setting crc source to NULL. X-Git-Tag: v5.6-rc1~114^2~13^2~31 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=292f3e496be0cac933dfa86e9d0bea5d96224c14;p=linux.git drm: Set crc->opened to false before setting crc source to NULL. to terminate the while-loop in drm_dp_aux_crc_work when drm_dp_start/stop_crc are called in the hook to set crc source. v3: set crc->opened to false without checking (Nick) v2: Move spin_lock around entire crc->opened use (Daniel) Cc: Daniel Vetter Cc: Harry Wentland Cc: Nick Kazlauskas Signed-off-by: Dingchen Zhang Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/msgid/20190726173743.11641-1-dingchen.zhang@amd.com --- diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 2ece2957da1a..e22b812c4b80 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -258,6 +258,11 @@ static int crtc_crc_release(struct inode *inode, struct file *filep) struct drm_crtc *crtc = filep->f_inode->i_private; struct drm_crtc_crc *crc = &crtc->crc; + /* terminate the infinite while loop if 'drm_dp_aux_crc_work' running */ + spin_lock_irq(&crc->lock); + crc->opened = false; + spin_unlock_irq(&crc->lock); + crtc->funcs->set_crc_source(crtc, NULL); spin_lock_irq(&crc->lock);