From: sashiko-bot@kernel.org
To: "Myeonghun Pak" <mhun512@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbdev: sstfb: use managed PCI device enable
Date: Fri, 11 Sep 2026 00:18:31 +0000 [thread overview]
Message-ID: <20260911001831.98D081F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911000835.88909-1-mhun512@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Unregistering the framebuffer after tearing down hardware mappings creates an exploitable use-after-free/unmap race condition.
- [High] Hardware is left in an active, initialized state on probe error paths because `sst_shutdown()` is missing.
- [High] `__sst_wait_idle()` contains an unbounded busy loop that will silently hang the CPU if the device becomes unresponsive.
--
commit 9516997f46dea14ef20c216ac89acefd0aaf2e36
Author: Myeonghun Pak <mhun512@gmail.com>
fbdev: sstfb: use managed PCI device enable
This commit updates sstfb_probe() to use pcim_enable_device() instead of
pci_enable_device(). This ensures that the PCI device is automatically
disabled by the PCI core after a probe failure or driver removal. The driver
still explicitly releases its other resources.
> diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c
> index 2745557822f76..039279feb5bf4 100644
> --- a/drivers/video/fbdev/sstfb.c
> +++ b/drivers/video/fbdev/sstfb.c
> @@ -1332,7 +1332,8 @@ static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> return err;
>
> /* Enable device in PCI config. */
> - if ((err=pci_enable_device(pdev))) {
> + err = pcim_enable_device(pdev);
> + if (err) {
> printk(KERN_ERR "cannot enable device\n");
> return err;
> }
[Severity: High]
This is a pre-existing issue, but hardware is left in an active, initialized
state on probe error paths because sst_shutdown() is missing.
During sstfb_probe(), sst_init() is called to configure the hardware. If a
subsequent initialization step fails, the error path unwinds memory but omits
calling sst_shutdown():
drivers/video/fbdev/sstfb.c:sstfb_probe() {
...
if (!sst_init(info, par)) {
printk(KERN_ERR "sstfb: Init failed\n");
goto fail;
}
...
fail:
iounmap(info->screen_base);
...
}
Would this leave the PCI device fully active and configured, potentially
breaking system functionality like leaving VGA pass-through disabled?
[Severity: High]
This is a pre-existing issue, but unregistering the framebuffer after tearing
down hardware mappings creates an exploitable use-after-free/unmap race
condition.
If a user opens the framebuffer device, and then the driver is unbound,
sstfb_remove() unmaps the memory before unregistering the framebuffer:
drivers/video/fbdev/sstfb.c:sstfb_remove() {
...
iounmap(info->screen_base);
iounmap(par->mmio_vbase);
...
unregister_framebuffer(info);
...
}
Could a user then issue an ioctl (like SSTFB_SET_VGAPASS), which calls
sstfb_ioctl() and accesses the now-unmapped memory?
[Severity: High]
This is a pre-existing issue, but __sst_wait_idle() contains an unbounded
busy loop that could silently hang the CPU if the device becomes unresponsive.
__sst_wait_idle() is called repeatedly during device operation and waits for
the busy status to clear:
drivers/video/fbdev/sstfb.c:__sst_wait_idle() {
...
while(1) {
if (__sst_read(vbase, STATUS) & STATUS_FBI_BUSY) {
...
}
If the PCI device is removed (e.g., via surprise unplug) or fails, the MMIO
read will return ~0. Since STATUS_FBI_BUSY is BIT(7), the condition would
remain true indefinitely. Should there be a timeout or fallback here to
prevent a permanent kernel hang?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911000835.88909-1-mhun512@gmail.com?part=1
next prev parent reply other threads:[~2026-09-11 0:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 0:08 [PATCH] fbdev: sstfb: use managed PCI device enable Myeonghun Pak
2026-09-11 0:18 ` sashiko-bot [this message]
2026-09-12 16:09 ` Helge Deller
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=20260911001831.98D081F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mhun512@gmail.com \
--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.