From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org,
ojeda@kernel.org, gary@garyguo.net,
"Michael S. Tsirkin" <mst@redhat.com>,
imx@lists.linux.dev, wsa+renesas@sang-engineering.com,
"Eugenio Perez" <eperezma@redhat.com>,
virtualization@lists.linux.dev, Frank.Li@kernel.org,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 02/14] drm/panic: Test address from kmap op for NULL
Date: Wed, 09 Sep 2026 09:15:10 +0000 [thread overview]
Message-ID: <20260909091511.011DA1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909085826.64529-3-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Potential NULL pointer dereference in `kmap_local_page_try_from_panic()` due to missing NULL checks for page pointers in `drm_panic_fill_page()` and `drm_panic_blit_page()`.
--
commit ddaf01e3dc4138e21af0a9818e11a3a8b5244eae
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/panic: Test address from kmap op for NULL
This patch adds a NULL check for the return value of
kmap_local_page_try_from_panic() to avoid dereferencing a failed mapping
during kernel panic screen rendering.
> 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 could next_page itself
be NULL here?
If a 24-bit pixel crosses a page boundary and the next page in the pages
array is NULL, passing it into kmap_local_page_try_from_panic() can cause
a NULL pointer dereference via PageHighMem(). If CONFIG_HIGHMEM is disabled,
page_to_virt(NULL) yields a garbage pointer which also crashes upon
dereference. This would cause a double fault during a kernel panic,
preventing the panic screen from rendering.
It looks like similar unchecked page pointers are passed elsewhere in
drivers/gpu/drm/drm_panic.c, such as in drm_panic_fill_page():
drm_panic_fill_page() {
...
vaddr = kmap_local_page_try_from_panic(pages[page]);
...
}
And in drm_panic_blit_page(), pages[page + 1] is passed without a NULL check
even though pages[new_page] is explicitly checked earlier in the function:
drm_panic_blit_page() {
...
drm_panic_write_pixel24_xpage(vaddr, pages[page + 1], offset, fg32);
...
}
Would it be safer to verify that next_page and pages[page] are not NULL
before attempting to map them, in order to safely handle unmapped or sparse
pages in the display buffer?
> + if (!vaddr2)
> + return;
>
> *p++ = color & 0xff;
> color >>= 8;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909085826.64529-1-tzimmermann@suse.de?part=2
next prev parent reply other threads:[~2026-09-09 9:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 8:55 [PATCH v4 00/14] drm/panic: Split into core and helpers Thomas Zimmermann
2026-09-09 8:55 ` [PATCH v4 01/14] drm/panic: Do not use un-escaped URL as format string Thomas Zimmermann
2026-09-09 9:09 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 02/14] drm/panic: Test address from kmap op for NULL Thomas Zimmermann
2026-09-09 9:15 ` sashiko-bot [this message]
2026-09-09 8:55 ` [PATCH v4 03/14] drm/panic: Return -EINVAL if font is not available Thomas Zimmermann
2026-09-09 9:08 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 04/14] drm/panic: Return errno codes if panic output fails Thomas Zimmermann
2026-09-09 9:13 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 05/14] drm/panic: Pass colors to draw_panic_dispatch() Thomas Zimmermann
2026-09-09 9:13 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 06/14] drm/panic: Pass global module parameters to drm_panic_dispatch() Thomas Zimmermann
2026-09-09 9:22 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 07/14] drm/panic: Return from screen_user if display is too small Thomas Zimmermann
2026-09-09 9:18 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 08/14] drm/panic: Retry in dispatch function if panic output fails Thomas Zimmermann
2026-09-09 9:17 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 09/14] drm/panic: Split draw_panic_plane() Thomas Zimmermann
2026-09-09 9:20 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 10/14] drm/panic: Restrict to primary planes Thomas Zimmermann
2026-09-09 9:22 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 11/14] drm/panic: Display panic screen via per-plane callback Thomas Zimmermann
2026-09-09 9:29 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 12/14] drm/panic: Internalize panic locking in DRM core and helpers Thomas Zimmermann
2026-09-09 9:28 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 13/14] drm/panic: Move panic display code into helper library Thomas Zimmermann
2026-09-09 9:32 ` sashiko-bot
2026-09-09 8:55 ` [PATCH v4 14/14] drm/panic: Compile KUnit tests as module Thomas Zimmermann
2026-09-09 9:37 ` sashiko-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=20260909091511.011DA1F00A3A@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;
as well as URLs for NNTP newsgroup(s).