From: sashiko-bot@kernel.org
To: "Yige Jiang" <yigejiang86@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] fbdev: ssd1307fb: release PWM if panel initialization fails
Date: Thu, 26 Nov 2026 13:40:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-235633@kernel.org> (raw)
In-Reply-To: <rc-b1-20261110-vc-112-b07bbe936b75@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] fbdev: ssd1307fb: invalid virtual address passed to
__free_pages() [1]
--
commit 0007b36f0bb513d1789d67a9c3b80f87e05fe107
Author: Yige Jiang <yigejiang86@gmail.com>
fbdev: ssd1307fb: release PWM if panel initialization fails
This commit updates ssd1307fb_probe() to jump to panel_init_error when
ssd1307fb_init() fails so that any requested PWM is disabled and released,
and clears par->pwm on pwm_get() failure.
Link: https://sashiko.dev/#/patchset/20260926-fix-fbdefio-error-handling-v1-0-a94810b6e263%40kernel.org
> diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
> index ef4bb920c6ff6..dbe5dc67e0442 100644
> --- a/drivers/video/fbdev/ssd1307fb.c
> +++ b/drivers/video/fbdev/ssd1307fb.c
[ ... ]
> @@ -823,7 +825,6 @@ static int ssd1307fb_probe(struct i2c_client *client)
> panel_init_error:
> pwm_disable(par->pwm);
> pwm_put(par->pwm);
> -regulator_enable_error:
> if (par->vbat_reg)
> regulator_disable(par->vbat_reg);
> reset_oled_error:
[Severity: Critical]
This problem wasn't introduced by this patch, but in this error path (and
in ssd1307fb_remove()), does fb_defio_error corrupt memory by passing a
virtual address to __free_pages() [1]?
vmem is allocated with __get_free_pages(), which returns a virtual address
stored as void *:
drivers/video/fbdev/ssd1307fb.c:ssd1307fb_probe() {
...
vmem = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
get_order(vmem_size));
...
fb_defio_error:
__free_pages(vmem, get_order(vmem_size));
}
__free_pages() expects a struct page *, whereas free_pages() takes a
virtual address. Because vmem and __va(info->fix.smem_start) are void *,
they convert implicitly to struct page *, causing __free_pages() to treat
the framebuffer buffer itself as a struct page descriptor on probe failure
or module unload.
[1] https://sashiko.dev/#/bug/linux-2cc48a80-14a7-42fb-ac37-6c2eebc04a6d
--
Sashiko AI review · https://sashiko.dev/#/patchset/rc-b1-20261110-vc-112-b07bbe936b75@gmail.com?part=1
prev parent reply other threads:[~2026-11-26 13:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 13:35 [PATCH] fbdev: ssd1307fb: release PWM if panel initialization fails Yige Jiang
2026-11-26 13:40 ` sashiko-bot [this message]
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-235633@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=yigejiang86@gmail.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 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.