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: fbdev: omap2: fix use-after-free in omapfb_mmap
Date: Thu, 04 Jun 2026 13:05:53 +1000	[thread overview]
Message-ID: <review-patch1-20260602080415.171378-1-zenghongling@kylinos.cn> (raw)
In-Reply-To: <20260602080415.171378-1-zenghongling@kylinos.cn>

Patch Review

**Correctness: Good.** The patch correctly inlines the logic of `omapfb_get_region_paddr()` using the already-locked `rg` pointer instead of going through `ofbi`:

```c
-	start = omapfb_get_region_paddr(ofbi);
-	len = fix->smem_len;
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
+		start = rg->vrfb.paddr[0];
+	else
+		start = rg->paddr;
+	len = rg->size;
```

The original `omapfb_get_region_paddr()` does:
```c
static u32 omapfb_get_region_paddr(const struct omapfb_info *ofbi)
{
	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
		return ofbi->region->vrfb.paddr[0];
	else
		return ofbi->region->paddr;
}
```

The patch correctly replaces `ofbi->region->` with `rg->` for the paddr access, and replaces `fix->smem_len` (which is also updated by `set_fb_fix()` during the ioctl) with `rg->size` — both now derived from the locked region.

**Note on `ofbi->rotation_type`:** The condition still reads `ofbi->rotation_type` without holding a lock that protects it. However, `rotation_type` is set once during probe and is not changed by `OMAPFB_SETUP_PLANE`, so this is safe. It's a property of the fb_info, not of the region.

**Note on `fix->smem_len` vs `rg->size`:** The original code read `fix->smem_len` which gets updated by `set_fb_fix()` inside `omapfb_setup_plane()` to reflect the new region. Switching to `rg->size` is correct — it reads the size of the region we actually locked and will map-count.

**Commit message quality:** Excellent. The step-by-step race scenario is clearly laid out and accurate. The Cc: stable tag is appropriate for a use-after-free fix.

**Minor style observation:** The inlined code duplicates the body of `omapfb_get_region_paddr()`. An alternative would be to refactor that helper to take a `struct omapfb2_mem_region *` parameter instead of `struct omapfb_info *`. However, this is a legacy fbdev driver unlikely to see further development, so the pragmatic inline approach is fine and arguably clearer for a -stable backport.

**Overall: Reviewed-by worthy.** The fix is minimal, correct, and addresses a real race condition.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04  3:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  8:04 [PATCH] fbdev: omap2: fix use-after-free in omapfb_mmap Hongling Zeng
2026-06-04  3:05 ` Claude Code Review Bot [this message]
2026-06-04  3:05 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-06-02  8:54 [PATCH v2] " Hongling Zeng
2026-06-04  3:04 ` Claude review: " Claude Code Review Bot
2026-06-04  3:04 ` 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-20260602080415.171378-1-zenghongling@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