svn commit: r310027 - head/sys/dev/drm2/i915

Konstantin Belousov kib at FreeBSD.org
Tue Dec 13 19:04:06 UTC 2016


Author: kib
Date: Tue Dec 13 19:04:05 2016
New Revision: 310027
URL: https://svnweb.freebsd.org/changeset/base/310027

Log:
  Fix bug in r309712, do not leak gem object pin count in case of error
  or retry.
  
  Reported and tested by:	Michael Butler <imb at protected-networks.net>
  Sponsored by:	The FreeBSD Foundation
  MFC after:	16 days

Modified:
  head/sys/dev/drm2/i915/i915_gem.c

Modified: head/sys/dev/drm2/i915/i915_gem.c
==============================================================================
--- head/sys/dev/drm2/i915/i915_gem.c	Tue Dec 13 18:15:11 2016	(r310026)
+++ head/sys/dev/drm2/i915/i915_gem.c	Tue Dec 13 19:04:05 2016	(r310027)
@@ -1521,7 +1521,7 @@ retry:
 	/* 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 @@ have_page:
 	return (VM_PAGER_OK);
 
 unpin:
+	i915_gem_object_unpin(obj);
+unlock:
 	DRM_UNLOCK(dev);
 out:
 	KASSERT(ret != 0, ("i915_gem_pager_fault: wrong return"));


More information about the svn-src-head mailing list