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/gem: Make the GEM LRU lock part of drm_device
Date: Sat, 16 May 2026 14:06:15 +1000	[thread overview]
Message-ID: <review-overall-20260512-panthor-shrinker-fixes-v3-1-3bf066259471@collabora.com> (raw)
In-Reply-To: <20260512-panthor-shrinker-fixes-v3-1-3bf066259471@collabora.com>

Overall Series Review

Subject: drm/gem: Make the GEM LRU lock part of drm_device
Author: Boris Brezillon <boris.brezillon@collabora.com>
Patches: 5
Reviewed: 2026-05-16T14:06:15.229271

---

This is a single patch (v3, distilled from an earlier 4-patch series) that addresses a real race condition in the DRM GEM LRU shrinker infrastructure. The race is between `drm_gem_lru_remove()` and `drm_gem_lru_scan()`: the old code reads `obj->lru` without the lock, dereferences it to get `lru->lock`, then takes that lock — but `obj->lru` can change (or become NULL) between the read and the lock acquisition. Since `drm_gem_lru_scan()` uses a stack-allocated `still_in_lru`, this can result in a use-after-free.

The fix is clean and well-motivated: move the lock from `struct drm_gem_lru` to `struct drm_device`, eliminating the chicken-and-egg problem entirely. The commit message clearly explains the rationale and acknowledges the trade-off (coarser locking, with a path to finer-grained locking if ever needed). The patch already has Reviewed-by tags from Rob Clark (MSM maintainer) and Liviu Dudau.

**Verdict: This patch looks correct and is ready to merge.** I have only minor observations below.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-16  4:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  6:59 [PATCH v3] drm/gem: Make the GEM LRU lock part of drm_device Boris Brezillon
2026-05-12 17:13 ` Chia-I Wu
2026-05-14  0:55 ` kernel test robot
2026-05-14  3:56 ` kernel test robot
2026-05-14 15:44 ` Steven Price
2026-05-16  4:06 ` Claude Code Review Bot [this message]
2026-05-16  4:06 ` Claude review: " 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-20260512-panthor-shrinker-fixes-v3-1-3bf066259471@collabora.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