From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/panthor: Fix the "done_fence is initialized" detection logic
Date: Tue, 10 Mar 2026 12:23:45 +1000 [thread overview]
Message-ID: <review-patch1-20260309124318.222902-1-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20260309124318.222902-1-boris.brezillon@collabora.com>
Patch Review
**Correctness**: The fix is correct. The old code:
```c
if (job->done_fence && job->done_fence->ops)
```
relied on `->ops` being non-NULL to distinguish an initialized (refcounted) fence from a merely allocated (kzalloc'd) one. After the upstream dma-buf change that clears `->ops` on signal, a signaled-but-initialized fence would incorrectly fall through to `dma_fence_free()` instead of `dma_fence_put()`, potentially causing a use-after-free or double-free.
The replacement:
```c
if (dma_fence_was_initialized(job->done_fence))
```
uses `dma_fence_was_initialized()` which checks `DMA_FENCE_FLAG_INITIALIZED_BIT` in `fence->flags` — a stable flag that survives signaling. It also handles the `fence == NULL` case internally (line 295 of `dma-fence.h`: `return fence && test_bit(...)`), so the NULL check that was previously part of the condition is preserved.
**Commit message**: Clear and well-structured. The `Fixes:` tag, `Reported-by:` tags, and v2 changelog are all present and correct.
**No issues found.** This is a straightforward, correct bug fix.
**Reviewed-by worthy**: Yes. The patch is minimal, well-targeted, and correctly uses the API designed for exactly this purpose.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-10 2:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 12:43 [PATCH v2] drm/panthor: Fix the "done_fence is initialized" detection logic Boris Brezillon
2026-03-09 12:50 ` Christian König
2026-03-09 13:11 ` Nicolas Frattaroli
2026-03-09 15:11 ` Steven Price
2026-03-09 17:30 ` Liviu Dudau
2026-03-10 2:23 ` Claude Code Review Bot [this message]
2026-03-10 2:23 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-03-09 10:30 [PATCH] " Boris Brezillon
2026-03-10 2:25 ` Claude review: " Claude Code Review Bot
2026-03-10 2:25 ` 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-patch1-20260309124318.222902-1-boris.brezillon@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