]> git.ipfire.org Git - people/arne_f/kernel.git/commit
drm/cirrus: Use drm_framebuffer_put to avoid kernel oops in clean-up
authorThomas Zimmermann <tzimmermann@suse.de>
Fri, 20 Jul 2018 11:27:43 +0000 (13:27 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 10 Aug 2018 05:57:47 +0000 (07:57 +0200)
commitabf7b30d7f61d981bfcca65d1e8331b27021b475
tree0eb90c3979902a88115d872286939406f927a01c
parentf82aab2d521e4c1d4f9f98450b4a9a8abeaff1c4
drm/cirrus: Use drm_framebuffer_put to avoid kernel oops in clean-up

In the Cirrus driver, the regular clean-up code also performs the clean-up
of a failed initialization. If the fbdev's framebuffer was not initialized,
the clean-up will fail within drm_framebuffer_unregister_private. Booting
with cirrus.bpp=16 triggers this bug.

The framebuffer is currently stored directly within struct cirrus_fbdev. To
fix the bug, we turn it into a pointer that is only set for initialized
framebuffers. The fbdev's clean-up code skips uninitialized framebuffers.

The memory for struct drm_framebuffer is allocated dynamically. This requires
additional error handling within cirrusfb_create. The framebuffer clean-up is
now performed by drm_framebuffer_put, which also frees the data strcuture's
memory.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1101822
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20180720112743.27159-1-tzimmermann@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/cirrus/cirrus_drv.h
drivers/gpu/drm/cirrus/cirrus_fbdev.c
drivers/gpu/drm/cirrus/cirrus_mode.c