mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: 李广硕 <liguangshuo@mail.sdu.edu.cn>
Cc: Jingoo Han <jingoohan1@gmail.com>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] fbdev: s3c-fb: Fix potential registration corruption on probe failure
Date: Thu, 19 Nov 2026 18:07:56 +0100	[thread overview]
Message-ID: <ccc56bc9-704e-43bd-b284-faf834ec4d10@gmx.de> (raw)
In-Reply-To: <AB2AtQBLLG04vL*MjX4Nuap6.3.1795092368475.Hmail.202321181@mail.sdu.edu.cn>

On 11/19/26 13:46, 李广硕 wrote:
> 
> 
> Hi Helge,
> 
> Thanks for the review.
> 
> From: Helge Deller <deller@gmx.de>
> Date: 2026-11-19 02:17:08
> To:  Guangshuo Li <liguangshuo@mail.sdu.edu.cn>,Jingoo Han <jingoohan1@gmail.com>
> Cc:  linux-fbdev@vger.kernel.org,dri-devel@lists.freedesktop.org,linux-kernel@vger.kernel.org,stable@vger.kernel.org
> Subject: Re: [PATCH] fbdev: s3c-fb: Fix potential registration corruption on probe failure>On 11/18/26 15:22, Guangshuo Li wrote:
>>> Probe failure cleanup calls unregister_framebuffer() even when the
>>> window has not been registered. Its zero-initialized node can then
>>> remove another framebuffer from registered_fb[0].
>>>
>>> Track successful registration and only unregister those framebuffers.
>>> Also skip empty window slots while unwinding a failed probe.
>>>
>>> This issue was found by our static analysis tool under development.
>>
>> I think s3c_fb_probe_win() needs to clean up when some things
>> like cmap fail to be allocated.
>> Your patch seems to just work around one of the possible pitfalls.
>>
>> Helge
>>
> 
> s3c_fb_probe_win() sets *res early and carries on if fb_alloc_cmap()
> fails. I think it should unwind the current window on failure and set
> *res only after register_framebuffer() succeeds. That would leave the
> caller with just the registered windows to clean up.
> 
> Is that where you'd put the cleanup?

Yes, I think s3c_fb_probe_win() should be able to handle every possible
error inside this function and do nice cleanups if it fails.

> If so, I'll send a v2 without the extra registration flag.
Thanks!

Helge

      reply	other threads:[~2026-11-19 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:22 Guangshuo Li
2026-11-18 18:17 ` Helge Deller
2026-11-19 12:46   ` 李广硕
2026-11-19 17:07     ` Helge Deller [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=ccc56bc9-704e-43bd-b284-faf834ec4d10@gmx.de \
    --to=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=liguangshuo@mail.sdu.edu.cn \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®