Repository navigation
drm/apple: backlight: pair drm_modeset_acquire_init() with _fini() - #57
Merged
RyanTheTide merged 1 commit intoOct 8, 2026
Conversation
dcp_set_brightness() and drm_crtc_set_brightness() initialize a drm_modeset_acquire_ctx on the stack but never call drm_modeset_acquire_fini(), including on their -EDEADLK and -ERESTARTSYS returns. With lockdep the acquire context is tracked as a held lock until ww_acquire_fini(), so it stays on the task's held-lock stack after the function returns. When the backlight core then unlocks bd->ops_lock, lockdep walks into the stale entry: DEBUG_LOCKS_WARN_ON(1) WARNING: kernel/locking/lockdep.c:238 at __lock_acquire+0x938/0x1600 ... mutex_unlock backlight_device_set_brightness brightness_store Unable to handle kernel NULL pointer dereference at virtual address 00000000000000c4 This happens in systemd-backlight on every boot of a PROVE_LOCKING kernel. Call drm_modeset_acquire_fini() on every exit path. Tested on j416s (M2 Pro) with PROVE_LOCKING: the brightness restore at boot runs without a lockdep report. Fixes: c7f8e49 ("drm/apple: Relax locking for back light updates") Signed-off-by: Oliver Lukschander <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
DjDeveloperr
pushed a commit
that referenced
this pull request
Oct 15, 2026
Signed-off-by: Chris Kearney <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dcp_set_brightness()anddrm_crtc_set_brightness()calldrm_modeset_acquire_init()on a stack context but neverdrm_modeset_acquire_fini(), not even on the-EDEADLK/-ERESTARTSYSreturns.Under lockdep the acquire context stays on the task's held-lock stack after the function returns. The backlight core's
mutex_unlock(&bd->ops_lock)then walks into the stale entry:DEBUG_LOCKS_WARN_ON(1)in__lock_acquire, followed by a NULL pointer dereference in systemd-backlight on every boot of aPROVE_LOCKINGkernel. Without lockdep it is invisible, but still wrong.The fix adds
drm_modeset_acquire_fini()on every exit path (6 lines).Found while running a lockdep kernel for #8 on j416s (M2 Pro). With the fix, the brightness restore at boot runs with lockdep active and no report. Builds with
W=1; checkpatch only flags the trailer form.🤖 Generated with Claude Code