From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/tegra: rgb: Fix use-after-free and leak in tegra_dc_rgb_probe()
Date: Sun, 12 Apr 2026 13:58:42 +1000 [thread overview]
Message-ID: <review-patch1-20260407084629.283151-1-vulab@iscas.ac.cn> (raw)
In-Reply-To: <20260407084629.283151-1-vulab@iscas.ac.cn>
Patch Review
**Claimed bug 1 — "use-after-free":** The commit message states the reorder avoids "using np after it may have been freed (if the action registration fails)." This is incorrect. In the original code:
```c
err = devm_add_action_or_reset(dc->dev, tegra_dc_of_node_put, np);
if (err < 0)
return err;
if (!of_device_is_available(np))
return -ENODEV;
```
If `devm_add_action_or_reset()` fails, the `_or_reset` part calls `tegra_dc_of_node_put(np)` (freeing `np`), and then `err < 0` causes an **immediate return**. The `of_device_is_available(np)` call is never reached. There is no use-after-free.
**Claimed bug 2 — "reference leak":** The commit message claims `np` leaks "when the device is not available." This is also incorrect. In the original code, when `of_device_is_available(np)` returns false, `tegra_dc_rgb_probe()` returns `-ENODEV`. The caller in `dc.c:3255` explicitly ignores `-ENODEV`:
```c
err = tegra_dc_rgb_probe(dc);
if (err < 0 && err != -ENODEV)
return dev_err_probe(&pdev->dev, err, ...);
```
The overall device probe **succeeds**, so the devm action registered by `devm_add_action_or_reset()` remains active and will correctly call `of_node_put(np)` when the device is eventually removed. There is no leak.
**Assessment:** The patch is a **no-op from a correctness standpoint** — the reordering produces functionally equivalent behavior. The code after the patch is marginally tidier (avoids leaving a devm action registered for a node that won't be used), but this is a minor cleanup, not a bug fix. The `Fixes:` tag and `Cc: stable` are unwarranted.
**Recommendation:** NAK in its current form. If the author wants to submit this as a minor cleanup/style improvement without the `Fixes:` tag, `Cc: stable`, and the incorrect bug claims in the commit message, that would be a more honest framing — though even then, the value is marginal.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-04-12 3:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 8:46 [PATCH] drm/tegra: rgb: Fix use-after-free and leak in tegra_dc_rgb_probe() Wentao Liang
2026-04-12 3:58 ` Claude Code Review Bot [this message]
2026-04-12 3:58 ` 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-20260407084629.283151-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