From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/v3d: Fix vaddr leak when indirect CSD has zeroed workgroups
Date: Thu, 04 Jun 2026 12:49:58 +1000 [thread overview]
Message-ID: <review-patch1-20260602-v3d-fix-indirect-csd-v3-1-cc79e06e543c@igalia.com> (raw)
In-Reply-To: <20260602-v3d-fix-indirect-csd-v3-1-cc79e06e543c@igalia.com>
Patch Review
**Status: Good**
This patch fixes a resource leak in `v3d_rewrite_csd_job_wg_counts_from_indirect()`. Looking at the existing code in the kernel tree (`v3d_sched.c:400-406`):
```c
v3d_get_bo_vaddr(bo);
v3d_get_bo_vaddr(indirect);
wg_counts = (uint32_t *)(bo->vaddr + indirect_csd->offset);
if (wg_counts[0] == 0 || wg_counts[1] == 0 || wg_counts[2] == 0)
return;
```
The bare `return` at line 406 skips the cleanup at lines 431-432 (`v3d_put_bo_vaddr(indirect)` / `v3d_put_bo_vaddr(bo)`), leaking both mappings. The fix correctly replaces `return` with `goto unmap_bo`, which jumps to the cleanup path:
```c
if (wg_counts[0] == 0 || wg_counts[1] == 0 || wg_counts[2] == 0)
goto unmap_bo;
```
```c
unmap_bo:
v3d_put_bo_vaddr(indirect);
v3d_put_bo_vaddr(bo);
```
The label placement is correct — it sits right before both `v3d_put_bo_vaddr` calls, matching the acquisition order (bo, indirect acquired; indirect, bo released). The label name `unmap_bo` is slightly ambiguous since it unmaps both BOs, but this is a minor style nit that doesn't affect correctness.
One observation: when the zero-workgroup path is taken, `args->cfg[0..4]` are left untouched — they retain whatever userspace submitted. This is fine because patch 2 ensures the CSD job is never submitted to hardware when counts are zero.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 2:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 11:57 [PATCH v3 0/2] drm/v3d: Fix indirect CSD jobs with zeroed workgroups Maíra Canal
2026-06-02 11:57 ` [PATCH v3 1/2] drm/v3d: Fix vaddr leak when indirect CSD has " Maíra Canal
2026-06-04 2:49 ` Claude Code Review Bot [this message]
2026-06-02 11:57 ` [PATCH v3 2/2] drm/v3d: Skip CSD when it " Maíra Canal
2026-06-04 2:49 ` Claude review: " Claude Code Review Bot
2026-06-04 2:49 ` Claude review: drm/v3d: Fix indirect CSD jobs with " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-06-02 17:50 [PATCH v4 0/2] " Maíra Canal
2026-06-02 17:50 ` [PATCH v4 1/2] drm/v3d: Fix vaddr leak when indirect CSD has " Maíra Canal
2026-06-04 2:23 ` Claude review: " Claude Code Review Bot
2026-06-01 19:13 [PATCH v2 0/2] drm/v3d: Fix indirect CSD jobs with " Maíra Canal
2026-06-01 19:13 ` [PATCH v2 1/2] drm/v3d: Fix vaddr leak when indirect CSD has " Maíra Canal
2026-06-04 3:44 ` Claude review: " Claude Code Review Bot
2026-05-30 19:51 [PATCH 0/2] drm/v3d: Fix indirect CSD jobs with " Maíra Canal
2026-05-30 19:51 ` [PATCH 1/2] drm/v3d: Fix vaddr leak when indirect CSD has " Maíra Canal
2026-06-04 5:15 ` 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-patch1-20260602-v3d-fix-indirect-csd-v3-1-cc79e06e543c@igalia.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