From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram()
Date: Mon, 25 May 2026 21:54:00 +1000 [thread overview]
Message-ID: <review-overall-20260520014721.32696-1-yaolu@kylinos.cn> (raw)
In-Reply-To: <20260520014721.32696-1-yaolu@kylinos.cn>
Overall Series Review
Subject: drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram()
Author: yaolu@kylinos.cn
Patches: 5
Reviewed: 2026-05-25T21:54:00.145158
---
This mbox contains two versions of the same patch (v2 and v3) addressing a `pci_dev` refcount leak in the loongson display driver. The v3 patch is the latest and supersedes v2.
**v2** added a `pci_dev_put()` call but kept storing the reference in `ldev->gpu` — which would create a use-after-free risk (putting the reference while still holding a dangling pointer).
**v3** is the correct approach: it removes the unused `ldev->gpu` member entirely and drops the reference immediately after extracting the BAR resource information. This is clean and correct.
The fix is straightforward and addresses a real refcount leak. The `pci_get_domain_bus_and_slot()` function increments the refcount on the returned `pci_dev`, and without a corresponding `pci_dev_put()`, the device reference is leaked. Since the only information needed from `pdev_gpu` is the BAR base/size (extracted via `pci_resource_start`/`pci_resource_len`), there is no need to hold the reference long-term.
**Verdict:** v3 looks good to merge.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-05-25 11:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 7:38 [PATH] drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram yaolu
2026-05-19 8:00 ` Markus Elfring
2026-05-20 1:47 ` [PATCH v2] drm/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram() yaolu
2026-05-20 9:05 ` Markus Elfring
2026-05-20 9:11 ` Xi Ruoyao
2026-05-20 12:05 ` [PATCH v3] drm/loongson: rm unused member lsdc_device->gpu yaolu
2026-05-20 13:19 ` Markus Elfring
2026-05-25 11:54 ` Claude Code Review Bot [this message]
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-20260520014721.32696-1-yaolu@kylinos.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