video/logo: prevent use of logos after they have been freed
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 18 Dec 2014 11:40:06 +0000 (13:40 +0200)
committerJiri Slaby <jslaby@suse.cz>
Wed, 28 Jan 2015 08:27:34 +0000 (09:27 +0100)
commit8871196bc148ee2e2e731a541666acdcf21609e4
tree025973dcac3c72095b79d5bd1d0c860ba31bd4b8
parent8e2aaf56683302f62e6e5bd5dc793deaca0076c2
video/logo: prevent use of logos after they have been freed

commit 92b004d1aa9f367c372511ca0330f58216b25703 upstream.

If the probe of an fb driver has been deferred due to missing
dependencies, and the probe is later ran when a module is loaded, the
fbdev framework will try to find a logo to use.

However, the logos are __initdata, and have already been freed. This
causes sometimes page faults, if the logo memory is not mapped,
sometimes other random crashes as the logo data is invalid, and
sometimes nothing, if the fbdev decides to reject the logo (e.g. the
random value depicting the logo's height is too big).

This patch adds a late_initcall function to mark the logos as freed. In
reality the logos are freed later, and fbdev probe may be ran between
this late_initcall and the freeing of the logos. In that case we will
miss drawing the logo, even if it would be possible.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/video/logo/logo.c