drm/vmwgfx: Make sure backup_handle is always valid
authorSinclair Yeh <syeh@vmware.com>
Fri, 2 Jun 2017 05:50:57 +0000 (07:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2017 13:06:04 +0000 (15:06 +0200)
commit7860d0e5e2bf986d4bd06e7b029786747b5dc766
treed4eb60081ce339ca10a3ef72c17655be19231e19
parenta76ff847013a7f6b1cd328381ca263ddcca12061
drm/vmwgfx: Make sure backup_handle is always valid

commit 07678eca2cf9c9a18584e546c2b2a0d0c9a3150c upstream.

When vmw_gb_surface_define_ioctl() is called with an existing buffer,
we end up returning an uninitialized variable in the backup_handle.

The fix is to first initialize backup_handle to 0 just to be sure, and
second, when a user-provided buffer is found, we will use the
req->buffer_handle as the backup_handle.

Reported-by: Murray McAllister <murray.mcallister@insomniasec.com>
Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Deepak Rawat <drawat@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c