From: sashiko-bot@kernel.org
To: "Alexandru Dadu" <alexandru.dadu@imgtec.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/imagination: Limit access to the MIPS firmware interface
Date: Wed, 14 Oct 2026 08:32:16 +0000 [thread overview]
Message-ID: <sashiko-outbox-171014@kernel.org> (raw)
In-Reply-To: <20261014-b4-simplify-mips-pte-defs-v1-1-b4ad7bb68e22@imgtec.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/imagination: kernel panic in pvr_vm_mips_map() on 64KB-page systems due to 0-page vmap
--
commit f751c0095eefbac6525746590080b3626f16f23d
Author: Alessio Belle <alessio.belle@imgtec.com>
drm/imagination: Limit access to the MIPS firmware interface
This commit restricts access to the MIPS firmware interface by using the
generic firmware interface or the MIPS-specific VM interface. It splits the
pvr_fw_mips_data struct into internal structures and removes the public
MIPS firmware interface header.
> diff --git a/drivers/gpu/drm/imagination/pvr_vm_mips.c b/drivers/gpu/drm/imagination/pvr_vm_mips.c
> index 5847a1c92bea8..264ea0fccf9c1 100644
> --- a/drivers/gpu/drm/imagination/pvr_vm_mips.c
> +++ b/drivers/gpu/drm/imagination/pvr_vm_mips.c
> @@ -43,49 +69,49 @@ pvr_vm_mips_init(struct pvr_device *pvr_dev)
[ ... ]
> - mips_data->pt = vmap(mips_data->pt_pages, pt_size >> PAGE_SHIFT, VM_MAP,
> - pgprot_writecombine(PAGE_KERNEL));
> - if (!mips_data->pt) {
> + vm_data->pt = vmap(vm_data->pt_pages, pt_size >> PAGE_SHIFT, VM_MAP,
> + pgprot_writecombine(PAGE_KERNEL));
> + if (!vm_data->pt) {
[Severity: High]
Does this code handle architectures with 64KB pages correctly?
During DRM driver initialization, pvr_vm_mips_init() allocates firmware
page tables. The page table size pt_size evaluates to 16384 bytes (16KB).
When vmap() is called here, pt_size >> PAGE_SHIFT evaluates to 0 on
architectures with 64KB pages (PAGE_SHIFT=16). Passing a 0 page count to
vmap() returns a non-NULL pointer to an unmapped guard page area.
> @@ -190,10 +216,10 @@ pvr_vm_mips_map(struct pvr_device *pvr_dev, struct pvr_fw_object *fw_obj)
> goto err_unmap_pages;
>
> pte = ((dma_addr >> ROGUE_MIPSFW_LOG2_PAGE_SIZE_4K)
> - << ROGUE_MIPSFW_ENTRYLO_PFN_SHIFT) & mips_data->pfn_mask;
> + << ROGUE_MIPSFW_ENTRYLO_PFN_SHIFT) & vm_data->pfn_mask;
> pte |= pte_flags;
>
> - WRITE_ONCE(mips_data->pt[pfn], pte);
> + WRITE_ONCE(vm_data->pt[pfn], pte);
[Severity: High]
Can this write trigger a kernel panic on 64KB-page systems?
If vm_data->pt points to an unmapped guard page returned by vmap() due to
the 0 page count, writing to vm_data->pt[pfn] here will dereference that
unmapped address and cause a page fault.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-b4-simplify-mips-pte-defs-v1-0-b4ad7bb68e22@imgtec.com?part=1
next prev parent reply other threads:[~2026-10-14 8:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 8:13 [PATCH 0/4] drm/imagination: Clean up MIPS firmware interfaces Alexandru Dadu
2026-10-14 8:13 ` Alexandru Dadu
2026-10-14 8:13 ` [PATCH 1/4] drm/imagination: Limit access to the MIPS firmware interface Alexandru Dadu
2026-10-14 8:13 ` Alexandru Dadu
2026-10-14 8:32 ` sashiko-bot [this message]
2026-10-14 8:13 ` [PATCH 2/4] drm/imagination: Make the MIPS firmware headers arch-independent Alexandru Dadu
2026-10-14 8:13 ` Alexandru Dadu
2026-10-14 8:13 ` [PATCH 3/4] drm/imagination: Improve some logging in error paths Alexandru Dadu
2026-10-14 8:13 ` Alexandru Dadu
2026-10-14 8:13 ` [PATCH 4/4] drm/imagination: Simplify MIPS PTE definitions Alexandru Dadu
2026-10-14 8:13 ` Alexandru Dadu
2026-10-14 8:34 ` 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=sashiko-outbox-171014@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandru.dadu@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.