Re: [PATCH] fbdev: s3c-fb: Fix potential registration corruption on probe failure

From: Helge Deller

Date: Thu Nov 19 2026 - 12:09:20 EST


On 11/19/26 13:46, 李广硕 wrote:


Hi Helge,

Thanks for the review.

From: Helge Deller <deller@xxxxxx>
Date: 2026-11-19 02:17:08
To: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>,Jingoo Han <jingoohan1@xxxxxxxxx>
Cc: linux-fbdev@xxxxxxxxxxxxxxx,dri-devel@xxxxxxxxxxxxxxxxxxxxx,linux-kernel@xxxxxxxxxxxxxxx,stable@xxxxxxxxxxxxxxx
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