drm/i915/gvt: fix dropping obj reference twice
authorPan Bian <bianpan2016@163.com>
Wed, 6 Nov 2019 07:31:07 +0000 (15:31 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 8 Nov 2019 03:04:07 +0000 (11:04 +0800)
commit41d931459b53e32c67a1f8838d1e6826a69ee745
treea80848e715fb2521ce30d97e7036762d2eb65976
parentee2c5ef8a9d640ee1617ec97b84fe2f634284e51
drm/i915/gvt: fix dropping obj reference twice

The reference count of obj will be decremented twice if error occurs
in dma_buf_fd(). Additionally, attempting to read the reference count of
obj after dropping reference may lead to a use after free bug. Here, we
drop obj's reference until it is not used.

Fixes: e546e281d33d ("drm/i915/gvt: Dmabuf support for GVT-g")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/dmabuf.c