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/qxl: fix local_gobj leak in qxl_gem_object_create_with_handle
Date: Thu, 04 Jun 2026 14:38:32 +1000	[thread overview]
Message-ID: <review-patch1-20260601064932.227375-1-lihongtao@kylinos.cn> (raw)
In-Reply-To: <20260601064932.227375-1-lihongtao@kylinos.cn>

Patch Review

**Bug analysis is correct.** Looking at the function in `drivers/gpu/drm/qxl/qxl_gem.c:82-114`:

1. `qxl_gem_object_create()` (line 95) creates a GEM object and returns it via `local_gobj` with a reference held.
2. `drm_gem_handle_create()` (line 101) takes its own reference on the object if it succeeds.
3. If `drm_gem_handle_create()` fails, the original code returned `r` immediately without dropping the reference from step 1 — leaking the object.

**The fix is correct:**
```c
r = drm_gem_handle_create(file_priv, local_gobj, handle);
if (r) {
    drm_gem_object_put(local_gobj);
    return r;
}
```

Adding `drm_gem_object_put(local_gobj)` in the error path properly releases the reference obtained from `qxl_gem_object_create()`.

**Note the existing code on the success path** (lines 107-111) already demonstrates the correct pattern — when `gobj` is NULL, it drops the allocate reference since the handle holds one. The error path was simply missing the same cleanup.

**Minor nit on the Fixes tag format:** The tag reads `Fixes: f64122c1f6ad("drm: add new QXL driver. (v1.4)")` but the standard kernel format has a space before the parenthesis: `Fixes: f64122c1f6ad ("drm: add new QXL driver. (v1.4)")`. This is cosmetic but worth fixing for consistency with `gitlint` and kernel conventions.

**No other issues.** The patch is minimal, correctly scoped, and addresses a real resource leak that has existed since the driver was introduced.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-06-04  4:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  6:49 [PATCH] drm/qxl: fix local_gobj leak in qxl_gem_object_create_with_handle Hongtao Lee
2026-06-04  4:38 ` Claude review: " Claude Code Review Bot
2026-06-04  4:38 ` 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-patch1-20260601064932.227375-1-lihongtao@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