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/bridge: it6505: fix use-after-free in it6505_parse_dt()
Date: Sun, 12 Apr 2026 11:30:02 +1000	[thread overview]
Message-ID: <review-patch1-20260409084817.470401-1-vulab@iscas.ac.cn> (raw)
In-Reply-To: <20260409084817.470401-1-vulab@iscas.ac.cn>

Patch Review

**The identified bug is real.** In the original code:
```c
ep = of_graph_get_endpoint_by_regs(np, 0, 0);
of_node_put(ep);

if (ep) {
    len = of_property_read_variable_u64_array(ep, /* use-after-free */
                          "link-frequencies",
                          &link_frequencies, 0, 1);
```
`of_node_put(ep)` is called before `ep` is used in `of_property_read_variable_u64_array()`. Moving the put after the last use of `ep` is the correct fix for this instance.

**Issue 1 — Unnecessary `of_node_put(ep)` in the `else` branch.** The patch adds:
```c
} else {
    of_node_put(ep);
    dev_err(dev, "error endpoint, use default");
```
The `else` branch is only entered when `ep == NULL`. `of_node_put(NULL)` is a no-op (it checks for NULL internally), so this call is dead code. It's harmless but misleading — it gives the impression that a real reference is being released. This should be removed.

**Issue 2 — Same bug exists at lines 3344–3353 (unfixed).** The exact same use-after-free pattern exists earlier in the function for the *first* endpoint lookup:
```c
ep = of_graph_get_endpoint_by_regs(np, 1, 0);   /* line 3344 */
of_node_put(ep);                                  /* line 3345 — too early! */

if (ep) {
    len = it6505_get_data_lanes_count(ep, 1, 4);  /* line 3348 — use-after-free */

    if (len > 0 && len != 3) {
        of_property_read_u32_array(ep, "data-lanes",  /* line 3351 — use-after-free */
                       data_lanes, len);
```
Here `ep` is used in both `it6505_get_data_lanes_count()` and `of_property_read_u32_array()` after the refcount has already been dropped. A complete fix should address both instances. Since the commit message says "fix use-after-free in it6505_parse_dt()" and the Fixes tag references the commit that introduced *both* patterns, readers would expect both to be fixed.

**Recommendation:** Resubmit with both instances fixed, and drop the no-op `of_node_put(ep)` from the `else` branches. The fix for both should be the same: move `of_node_put(ep)` to inside the `if (ep)` block, after the last use of `ep`.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-04-12  1:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  8:48 [PATCH] drm/bridge: it6505: fix use-after-free in it6505_parse_dt() Wentao Liang
2026-04-12  1:30 ` Claude Code Review Bot [this message]
2026-04-12  1:30 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-07  9:38 [PATCH] " Wentao Liang
2026-04-12  3:40 ` Claude review: " Claude Code Review Bot
2026-04-12  3:40 ` 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-20260409084817.470401-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