OSDN Git Service

drm/fb-helper: generic: Fix setup error path
authorNoralf Trønnes <noralf@tronnes.org>
Sat, 5 Jan 2019 18:18:46 +0000 (19:18 +0100)
committerNoralf Trønnes <noralf@tronnes.org>
Tue, 8 Jan 2019 17:46:16 +0000 (18:46 +0100)
commit6e1490cf439aa86b104e5124c36275b964238e1f
tree4405bb851d6c48a0fd67d2d6dbe2c4a25c194142
parentcb66c6daa5e9b2b2aa7ebe956e329c81c1ffe466
drm/fb-helper: generic: Fix setup error path

If register_framebuffer() fails during fbdev setup we will leak the
framebuffer, the GEM buffer and the shadow buffer for defio. This is
because drm_fb_helper_fbdev_setup() just calls drm_fb_helper_fini() on
error not taking into account that register_framebuffer() can fail.

Since the generic emulation uses DRM client for its framebuffer and
backing buffer in addition to a shadow buffer, it's necessary to open code
drm_fb_helper_fbdev_setup() to properly handle the error path.

Error cleanup is removed from .fb_probe and is handled by one function for
all paths.

Fixes: 9060d7f49376 ("drm/fb-helper: Finish the generic fbdev emulation")
Reported-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190105181846.26495-1-noralf@tronnes.org
drivers/gpu/drm/drm_fb_helper.c