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/loongson: fix pci_dev refcount leak in lsdc_get_dedicated_vram() Date: Mon, 25 May 2026 21:54:00 +1000 Message-ID: In-Reply-To: <20260520014721.32696-1-yaolu@kylinos.cn> References: <20260520014721.32696-1-yaolu@kylinos.cn> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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` =E2=80=94 which would create a use-after-free risk (putting the refe= rence while still holding a dangling pointer). **v3** is the correct approach: it removes the unused `ldev->gpu` member en= tirely and drops the reference immediately after extracting the BAR resourc= e 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 `p= ci_dev`, and without a corresponding `pci_dev_put()`, the device reference = is leaked. Since the only information needed from `pdev_gpu` is the BAR bas= e/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