Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Oct 2015 16:59:08 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288452 - head/sys/dev/drm2/i915
Message-ID:  <201510011659.t91Gx8SX094039@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Thu Oct  1 16:59:07 2015
New Revision: 288452
URL: https://svnweb.freebsd.org/changeset/base/288452

Log:
  Most error cases in i915_gem_do_execbuffer() jump to one of two labels to
  release resources (such as unholding pages) when errors occur.  Some
  recently added error checks return immediately instead of jumping to a
  label resulting in leaks.  Fix these to jump to a label to do cleanup
  instead.
  
  Reviewed by:	kib
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D3745

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

Modified: head/sys/dev/drm2/i915/i915_gem_execbuffer.c
==============================================================================
--- head/sys/dev/drm2/i915/i915_gem_execbuffer.c	Thu Oct  1 16:34:53 2015	(r288451)
+++ head/sys/dev/drm2/i915/i915_gem_execbuffer.c	Thu Oct  1 16:59:07 2015	(r288452)
@@ -1151,7 +1151,8 @@ i915_gem_do_execbuffer(struct drm_device
 		if (ctx_id != 0) {
 			DRM_DEBUG("Ring %s doesn't support contexts\n",
 				  ring->name);
-			return -EPERM;
+			ret = -EPERM;
+			goto pre_struct_lock_err;
 		}
 		break;
 	case I915_EXEC_BLT:
@@ -1159,7 +1160,8 @@ i915_gem_do_execbuffer(struct drm_device
 		if (ctx_id != 0) {
 			DRM_DEBUG("Ring %s doesn't support contexts\n",
 				  ring->name);
-			return -EPERM;
+			ret = -EPERM;
+			goto pre_struct_lock_err;
 		}
 		break;
 	default:
@@ -1171,7 +1173,8 @@ i915_gem_do_execbuffer(struct drm_device
 	if (!intel_ring_initialized(ring)) {
 		DRM_DEBUG("execbuf with invalid ring: %d\n",
 			  (int)(args->flags & I915_EXEC_RING_MASK));
-		return -EINVAL;
+		ret = -EINVAL;
+		goto pre_struct_lock_err;
 	}
 
 	mode = args->flags & I915_EXEC_CONSTANTS_MASK;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510011659.t91Gx8SX094039>