drm/vkms: Hold gem object while still in-use
authorEzequiel Garcia <ezequiel@collabora.com>
Mon, 27 Apr 2020 21:44:05 +0000 (18:44 -0300)
committerRodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Thu, 7 May 2020 01:51:46 +0000 (21:51 -0400)
commit0ea2ea42b31abc1141f2fd3911f952a97d401fcb
tree47cd2b2a7c0892bbb040ea4914d758414d7bf263
parentc27f0cc4d43a7f910e3cf779f44c470275604236
drm/vkms: Hold gem object while still in-use

We need to keep the reference to the drm_gem_object
until the last access by vkms_dumb_create.

Therefore, the put the object after it is used.

This fixes a use-after-free issue reported by syzbot.

While here, change vkms_gem_create() symbol to static.

Reported-and-tested-by: syzbot+e3372a2afe1e7ef04bc7@syzkaller.appspotmail.com
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200427214405.13069-1-ezequiel@collabora.com
drivers/gpu/drm/vkms/vkms_drv.h
drivers/gpu/drm/vkms/vkms_gem.c