public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/i915/modeset: fix NULL/ctx handling in lock paths
Date: Tue, 05 May 2026 11:50:03 +1000	[thread overview]
Message-ID: <review-overall-20260429060431.1462589-1-george.d.sworo@intel.com> (raw)
In-Reply-To: <20260429060431.1462589-1-george.d.sworo@intel.com>

Overall Series Review

Subject: drm/i915/modeset: fix NULL/ctx handling in lock paths
Author: george.d.sworo@intel.com
Patches: 6
Reviewed: 2026-05-05T11:50:03.943890

---

**NAK.** This series adds defensive NULL checks for `ctx` inside the static helper `modeset_lock()`, but this function **can never be called with a NULL `ctx`** in the existing code. The two callers are:

1. `drm_modeset_lock()` (line 394) — which already handles `ctx == NULL` at line 397 and only calls `modeset_lock()` when `ctx` is non-NULL.
2. `drm_modeset_backoff()` (line 360) — which dereferences `ctx->contended` before calling `modeset_lock()`, so `ctx` is necessarily non-NULL.

The cover letter claims this is "seen in HDCP/MST paths" but provides no crash log, stack trace, or reproducer. If there is genuinely a code path reaching this function with a NULL context, the correct fix is to fix the broken caller, not to silently paper over it in a core locking primitive. Adding a silent fallback to plain `ww_mutex_lock(..., NULL)` would bypass deadlock detection and lock tracking (`ctx->locked` list), which would mask real bugs and cause worse problems downstream (e.g., `drm_modeset_drop_locks()` wouldn't know about the lock).

The commit messages also claim `drm_modeset_drop_locks()` has the same problem, but neither patch touches that function.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-05  1:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29  2:59 [PATCH] drm/modeset_lock: add NULL check for ctx before WARN_ON george.d.sworo
2026-04-29  6:04 ` [PATCH v2 0/2] drm/i915/modeset: fix NULL/ctx handling in lock paths george.d.sworo
2026-04-29  6:04   ` [PATCH v2 1/2] drm/modeset_lock: add NULL check for ctx before WARN_ON george.d.sworo
2026-04-29 11:09     ` Ville Syrjälä
2026-04-30  4:12       ` Sworo, George D
2026-04-29  6:04   ` [PATCH v2 2/2] drm/modeset: harden modeset_lock() against NULL ctx george.d.sworo
2026-05-05  1:50     ` Claude review: " Claude Code Review Bot
2026-05-05  1:50   ` Claude Code Review Bot [this message]
2026-05-05  1:50 ` Claude review: drm/modeset_lock: add NULL check for ctx before WARN_ON Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-overall-20260429060431.1462589-1-george.d.sworo@intel.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox