Re: [PATCH] fbdev: cobalt_lcdfb: Don't read info after framebuffer_release()

From: Helge Deller

Date: Wed Nov 18 2026 - 14:06:56 EST


On 11/18/26 15:07, Suyuan Wang via B4 Relay wrote:
From: Suyuan Wang <stevewong@xxxxxxxxxxx>

When devm_platform_get_and_ioremap_resource() fails, cobalt_lcdfb_probe()
releases the framebuffer and then dereferences it for the return value:

framebuffer_release(info);
return PTR_ERR(info->screen_base);

framebuffer_release() frees info, so info->screen_base is read from freed
memory. Save the error code before releasing info.

Found with a static analysis tool and checked by hand.

Fixes: d2386d9e3eb4 ("fbdev: cobalt_lcdfb: Request memory region")
Cc: stable@xxxxxxxxxxxxxxx
Co-developed-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
Signed-off-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
Signed-off-by: Suyuan Wang <stevewong@xxxxxxxxxxx>
---
The change only moves the error-code read before framebuffer_release().
Checked by inspection; I couldn't build it here (MIPS, and my MIPS cross
toolchain fails at an unrelated host step), and I don't have the
hardware.
---
drivers/video/fbdev/cobalt_lcdfb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
applied.

Thanks!
Helge