From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/vc4: Fix a memory leak in hang state error path Date: Tue, 31 Mar 2026 17:02:00 +1000 Message-ID: In-Reply-To: <20260330-vc4-misc-fixes-v1-3-92defc940a29@igalia.com> References: <20260330-vc4-misc-fixes-v1-0-92defc940a29@igalia.com> <20260330-vc4-misc-fixes-v1-3-92defc940a29@igalia.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Verdict: Good fix.** Two early returns in `vc4_save_hang_state()` leaked the `kernel_state` allo= cation. The patch consolidates them into a single `err_free_state` label th= at unlocks the spinlock and frees `kernel_state`. ```c -if (!exec[0] && !exec[1]) { - spin_unlock_irqrestore(&vc4->job_lock, irqflags); - return; -} +if (!exec[0] && !exec[1]) + goto err_free_state; ``` And: ```c +err_free_state: + spin_unlock_irqrestore(&vc4->job_lock, irqflags); + kfree(kernel_state); ``` Both error paths hold the spinlock, and the label correctly releases it bef= ore freeing. Note this patch depends on patch 2 being applied first (the `k= free(state->bo)` in `vc4_free_hang_state`), but the second early return (`!= kernel_state->bo`) happens before `bo` is allocated, so `kfree(kernel_state= )` alone is sufficient at the error label =E2=80=94 `kernel_state->bo` is N= ULL in both error cases (either never assigned, or the allocation failed). = Correct. No issues. --- --- Generated by Claude Code Patch Reviewer