From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: accel/habanalabs: fix refcount leak in hl_direct_io()
Date: Thu, 04 Jun 2026 11:49:49 +1000 [thread overview]
Message-ID: <review-overall-20260603091055.3730941-1-vulab@iscas.ac.cn> (raw)
In-Reply-To: <20260603091055.3730941-1-vulab@iscas.ac.cn>
Overall Series Review
Subject: accel/habanalabs: fix refcount leak in hl_direct_io()
Author: Wentao Liang <vulab@iscas.ac.cn>
Patches: 1
Reviewed: 2026-06-04T11:49:49.715054
---
This is a single-patch series that fixes a refcount leak in the `hl_direct_io()` function in the habanalabs NVMe Direct I/O path. The fix is **correct and appropriate**.
When `hl_dio_get_iopath()` succeeds (line 235), it acquires two resources: it increments a per-CPU inflight I/O counter and takes a reference on the context via `hl_ctx_get()` (see `hl_dio_get_iopath()` at line 162). The corresponding cleanup function `hl_dio_put_iopath()` (line 170-176) releases both: it calls `hl_ctx_put()` and decrements the per-CPU counter.
Before this patch, if the `vzalloc()` at line 250 failed, the function returned `-ENOMEM` directly without calling `hl_dio_put_iopath()`, leaking both the context reference and the inflight I/O count. The existing `cleanup` label at line 274 already calls both `vfree(io->bv)` and `hl_dio_put_iopath(io->f.ctx)`, and `vfree(NULL)` is safe, so jumping there would have been an alternative — but the inline fix is equally correct and arguably clearer since it matches the early-return style already in use at this point in the function.
The series is minimal, well-targeted, and appropriate for stable backport.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-06-04 1:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 9:10 [PATCH] accel/habanalabs: fix refcount leak in hl_direct_io() Wentao Liang
2026-06-04 1:49 ` Claude Code Review Bot [this message]
2026-06-04 1:49 ` 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-20260603091055.3730941-1-vulab@iscas.ac.cn \
--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