]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/vmwgfx: Fix up user_dmabuf refcounting
authorThomas Hellstrom <thellstrom@vmware.com>
Mon, 14 Sep 2015 08:13:11 +0000 (01:13 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:28:31 +0000 (19:28 -0800)
commitb5a6121b8ad0e85d0b5dad465d55db8fb15bfc58
tree58bd122e74f96d77a4b01a53b76130e48c6ca0a6
parent33eb8012e4d61a4b478e8b923028494d28832478
drm/vmwgfx: Fix up user_dmabuf refcounting

Orabug: 22623829

commit 54c12bc374408faddbff75dbf1a6167c19af39c4 upstream.

If user space calls unreference on a user_dmabuf it will typically
kill the struct ttm_base_object member which is responsible for the
user-space visibility. However the dmabuf part may still be alive and
refcounted. In some situations, like for shared guest-backed surface
referencing/opening, the driver may try to reference the
struct ttm_base_object member again, causing an immediate kernel warning
and a later kernel NULL pointer dereference.

Fix this by always maintaining a reference on the struct
ttm_base_object member, in situations where it might subsequently be
referenced.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 435d5d7f3a0dd62dc1465c314e338f159fb7d43a)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c