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/modeset: harden modeset_lock() against NULL ctx Date: Tue, 05 May 2026 11:50:04 +1000 Message-ID: In-Reply-To: <20260429060431.1462589-3-george.d.sworo@intel.com> References: <20260429060431.1462589-1-george.d.sworo@intel.com> <20260429060431.1462589-3-george.d.sworo@intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **NAK.** The change adds an early-return path for NULL `ctx`: ```c + if (unlikely(!ctx)) { + if (interruptible) + return ww_mutex_lock_interruptible(&lock->mutex, NULL); + + ww_mutex_lock(&lock->mutex, NULL); + return 0; + } ``` **Problem 1: Still fixing a non-existent bug.** As above, `ctx` is never NU= LL here. **Problem 2: The fallback silently breaks locking invariants.** If this cod= e were ever reached, the lock would be acquired via plain `ww_mutex_lock(..= ., NULL)` but would **not** be added to `ctx->locked`. That means `drm_mode= set_drop_locks()` would not release it, causing a deadlock. The whole point= of the `modeset_lock()` helper is to integrate with the acquire-context tr= acking (lines 318-331); bypassing that tracking is worse than crashing. **Problem 3: Excessive comment.** The 4-line comment block explains what th= e code does, which is already self-evident from the `if (!ctx)` check. **Problem 4: Makes patch 1 redundant.** With this early return in place, th= e `ctx &&` guard added in patch 1 can never trigger (we already returned if= `ctx` is NULL). The two patches together are incoherent =E2=80=94 patch 2 = makes patch 1's change dead code. **Recommendation:** If the author is genuinely hitting a NULL `ctx` crash, = they should provide a full stack trace and fix the actual caller that is pa= ssing NULL. The existing `drm_modeset_lock()` API (line 394) already correc= tly handles NULL `ctx` =E2=80=94 the bug would be in whatever is calling an= internal path without going through the public API. --- Generated by Claude Code Patch Reviewer