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/imagination: Don't timeout job if its fence has been signaled
Date: Sat, 16 May 2026 14:11:25 +1000	[thread overview]
Message-ID: <review-patch2-20260512-b4-context_reset-v1-2-439bee96ed83@imgtec.com> (raw)
In-Reply-To: <20260512-b4-context_reset-v1-2-439bee96ed83@imgtec.com>

Patch Review

**Verdict: Bug — NULL pointer dereference**

The added check:

```c
if (dma_fence_is_signaled(s_job->s_fence->parent))
    return DRM_GPU_SCHED_STAT_NO_HANG;
```

`s_job->s_fence->parent` can be NULL. The parent fence is assigned by `drm_sched_fence_set_parent()` during `run_job`. If the timeout fires before the job has been run (e.g., the job was stuck in the pending queue), `parent` is NULL. This will cause a NULL dereference inside `dma_fence_is_signaled()`, which does not check for NULL.

The code later in the same function even has:

```c
WARN_ON(job->base.s_fence->parent);
job->base.s_fence->parent = dma_fence_get(job->done_fence);
```

...which explicitly expects `parent` to be NULL in some cases.

**Fix:** Add a NULL check:

```c
if (s_job->s_fence->parent &&
    dma_fence_is_signaled(s_job->s_fence->parent))
    return DRM_GPU_SCHED_STAT_NO_HANG;
```

The overall idea (avoid false timeouts when the fence has already signaled) is reasonable and used in other DRM scheduler drivers.

---
Generated by Claude Code Patch Reviewer

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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  6:47 [PATCH 0/4] drm/imagination: Multiple enhancement Brajesh Gupta
2026-05-12  6:47 ` [PATCH 1/4] drm/imagination: Populate FW common context ID before passing to the FW Brajesh Gupta
2026-05-16  4:11   ` Claude review: " Claude Code Review Bot
2026-05-12  6:47 ` [PATCH 2/4] drm/imagination: Don't timeout job if its fence has been signaled Brajesh Gupta
2026-05-16  4:11   ` Claude Code Review Bot [this message]
2026-05-12  6:47 ` [PATCH 3/4] drm/imagination: Rename FW booted to FW initialised Brajesh Gupta
2026-05-16  4:11   ` Claude review: " Claude Code Review Bot
2026-05-12  6:47 ` [PATCH 4/4] drm/imagination: Access FW initialised state with READ/WRITE_ONCE Brajesh Gupta
2026-05-16  4:11   ` Claude review: " Claude Code Review Bot
2026-05-16  4:11 ` Claude review: drm/imagination: Multiple enhancement 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-patch2-20260512-b4-context_reset-v1-2-439bee96ed83@imgtec.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