From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: imx@lists.linux.dev, linux-hyperv@vger.kernel.org,
dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
ojeda@kernel.org, wsa+renesas@sang-engineering.com,
"Eugenio Perez" <eperezma@redhat.com>,
intel-gfx@lists.freedesktop.org, gary@garyguo.net,
virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
Frank.Li@kernel.org
Subject: Re: [PATCH v5 02/14] drm/panic: Test address from kmap op for NULL
Date: Fri, 11 Sep 2026 12:58:16 +0000 [thread overview]
Message-ID: <20260911125816.9C6061F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911124540.279841-3-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing NULL checks for page pointers passed to kmap_local_page_try_from_panic() leads to a kernel panic in the panic handler.
--
commit 69a5d51433b94a040beb8954801343ad106c13c9
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/panic: Test address from kmap op for NULL
Do nothing if kmap_local_page_try_from_panic() returns NULL. This is
not likely to hapen, as the previous page from the same memory area
has been mapped successfully.
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v6.18+
> diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c
> index ba21df4be3380..d28ce8878e055 100644
> --- a/drivers/gpu/drm/drm_panic.c
> +++ b/drivers/gpu/drm/drm_panic.c
> @@ -178,6 +178,8 @@ static void drm_panic_write_pixel24_xpage(void *vaddr, struct page *next_page,
> u8 *p = vaddr + offset;
>
> vaddr2 = kmap_local_page_try_from_panic(next_page);
[Severity: High]
This isn't a bug introduced by this patch, but can next_page be NULL here,
leading to a kernel panic?
If a scanout buffer is sparse or partially unpinned, the pages array might
contain NULL pointers. While drm_panic_blit_page() checks for NULL before
most operations, when a 24-bit pixel crosses a page boundary it calls
drm_panic_write_pixel24_xpage(vaddr, pages[page + 1], ...).
If pages[page + 1] is NULL, passing it to kmap_local_page_try_from_panic()
causes a fatal page fault when attempting to dereference the page pointer.
Additionally, drm_panic_fill_page() seems to omit the page validation
entirely and passes pages[page] directly to kmap_local_page_try_from_panic():
drivers/gpu/drm/drm_panic.c:drm_panic_fill_page() {
...
vaddr = kmap_local_page_try_from_panic(pages[page]);
...
}
Should the page pointers be validated before attempting to map them?
> + if (!vaddr2)
> + return;
>
> *p++ = color & 0xff;
> color >>= 8;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911124540.279841-1-tzimmermann@suse.de?part=2
next prev parent reply other threads:[~2026-09-11 12:58 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 12:43 [PATCH v5 00/14] drm/panic: Split into core and helpers Thomas Zimmermann
2026-09-11 12:43 ` [PATCH v5 01/14] drm/panic: Do not use un-escaped URL as format string Thomas Zimmermann
2026-09-11 12:54 ` sashiko-bot
2026-09-11 12:43 ` [PATCH v5 02/14] drm/panic: Test address from kmap op for NULL Thomas Zimmermann
2026-09-11 12:58 ` sashiko-bot [this message]
2026-09-11 12:43 ` [PATCH v5 03/14] drm/panic: Return -EINVAL if font is not available Thomas Zimmermann
2026-09-11 12:53 ` sashiko-bot
2026-09-11 12:43 ` [PATCH v5 04/14] drm/panic: Return errno codes if panic output fails Thomas Zimmermann
2026-09-11 12:56 ` sashiko-bot
2026-09-11 12:43 ` [PATCH v5 05/14] drm/panic: Pass colors to draw_panic_dispatch() Thomas Zimmermann
2026-09-11 12:54 ` sashiko-bot
2026-09-11 12:43 ` [PATCH v5 06/14] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-09-11 12:56 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 07/14] drm/panic: Return from screen_user if display is too small Thomas Zimmermann
2026-09-11 12:54 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 08/14] drm/panic: Retry in dispatch function if panic output fails Thomas Zimmermann
2026-09-11 12:54 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 09/14] drm/panic: Split draw_panic_plane() Thomas Zimmermann
2026-09-11 12:53 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 10/14] drm/panic: Restrict to primary planes Thomas Zimmermann
2026-09-11 12:55 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 11/14] drm/panic: Display panic screen via per-plane callback Thomas Zimmermann
2026-09-11 12:59 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 12/14] drm/panic: Internalize panic locking in DRM core and helpers Thomas Zimmermann
2026-09-11 12:59 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 13/14] drm/panic: Move panic display code into helper library Thomas Zimmermann
2026-09-11 12:59 ` sashiko-bot
2026-09-11 12:44 ` [PATCH v5 14/14] drm/panic: Compile KUnit tests as module Thomas Zimmermann
2026-09-11 13:01 ` sashiko-bot
2026-09-11 13:19 ` ✗ CI.checkpatch: warning for drm/panic: Split into core and helpers (rev5) Patchwork
2026-09-11 13:21 ` ✓ CI.KUnit: success " Patchwork
2026-09-11 14:02 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-11 22:17 ` ✓ Xe.CI.FULL: " Patchwork
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=20260911125816.9C6061F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=eperezma@redhat.com \
--cc=gary@garyguo.net \
--cc=imx@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=mst@redhat.com \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.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