]> git.ipfire.org Git - thirdparty/linux.git/commit
fbdev: sm501fb: Fix buffer errors in OF binding code
authorDavid Laight <david.laight.linux@gmail.com>
Mon, 8 Jun 2026 12:42:42 +0000 (13:42 +0100)
committerHelge Deller <deller@gmx.de>
Tue, 9 Jun 2026 14:00:17 +0000 (16:00 +0200)
commitd8421e09382cfe0bd2a044c8b0a822f64855dd4e
treea9a691e9a881935fa8f4bdf1ad3b932b4b9c3065
parentf5c147fda9c6c553bfc2b86e0734b4594f2a9a7d
fbdev: sm501fb: Fix buffer errors in OF binding code

The code that gets the frame buffer mode from OF has 'use after free',
'buffer overrun' and memory leaks.

info->edid_data isn't free if the probe functions fail or if
pd->def_mode is set.

If both the CRT and PANEL are enabled info->edid_data is used after
being freed and is freed twice.

The string returned by of_get_property(np, "mode", &len) is just
written over either the static "640x480-16@60" or the module parameter
string without any regard for the length (which is most likely longer).

Use kstrump() for the OF mode and free everything before freeing 'info.

Fixes: 4295f9bf74a88 ("video, sm501: add OF binding to support SM501")
Signed-off-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/sm501fb.c