From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/gud: fix NULL crtc dereference on display disable Date: Mon, 23 Feb 2026 05:53:49 +1000 Message-ID: In-Reply-To: <20260222054551.80864-1-me@shenghaoyang.info> References: <20260222054551.80864-1-me@shenghaoyang.info> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Overall Series Review Subject: drm/gud: fix NULL crtc dereference on display disable Author: Shenghao Yang Patches: 1 Reviewed: 2026-02-23T05:53:49.308471 --- This is a single-patch fix for a NULL pointer dereference in the GUD (Generic USB Display) driver's `gud_plane_atomic_update()` function. When a display is disabled through normal desktop environment paths (as opposed to USB hotplug), `new_state->crtc` is NULL, and the function proceeds to dereference it after the `drm_dev_enter()` check (which only guards against USB disconnect). The crash was reported by the kernel test robot and Dan Carpenter. The fix takes the correct architectural approach: instead of adding more NULL checks inline, it refactors the crtc enable/disable logic out of the plane update function and into proper `atomic_enable`/`atomic_disable` CRTC helper callbacks. This delegates the crtc state transitions to the DRM atomic helpers, which is the standard pattern for DRM drivers. The switch to `drm_atomic_helper_commit_tail_rpm` ensures correct ordering (crtc enables before plane updates) and uses `DRM_PLANE_COMMIT_ACTIVE_ONLY` so planes on inactive CRTCs are not flushed. The patch introduces some behavioral changes compared to the old code: on mode changes, a full disable/re-enable cycle is performed (the old code only sent `SET_STATE_COMMIT` inline), and `SET_STATE_COMMIT` is now sent unconditionally on crtc enable. These are documented in the v5 changelog and appear to be intentional simplifications that the GUD protocol should tolerate. The patch is well-structured and correct. --- Generated by Claude Code Patch Reviewer