Fix bug in r309712, do not leak gem object pin count in case of error

or retry.

Reported and tested by:	Michael Butler <imb@protected-networks.net>
Sponsored by:	The FreeBSD Foundation
MFC after:	16 days
This commit is contained in:
Konstantin Belousov 2016-12-13 19:04:05 +00:00
parent c519c3c308
commit 8266737023

View File

@ -1521,7 +1521,7 @@ i915_gem_pager_populate(vm_object_t vm_obj, vm_pindex_t pidx, int fault_type,
/* Now bind it into the GTT if needed */
ret = i915_gem_object_pin(obj, 0, true, false);
if (ret)
goto unpin;
goto unlock;
pinned = 1;
ret = i915_gem_object_set_to_gtt_domain(obj, write);
@ -1580,6 +1580,8 @@ i915_gem_pager_populate(vm_object_t vm_obj, vm_pindex_t pidx, int fault_type,
return (VM_PAGER_OK);
unpin:
i915_gem_object_unpin(obj);
unlock:
DRM_UNLOCK(dev);
out:
KASSERT(ret != 0, ("i915_gem_pager_fault: wrong return"));