svn commit: r261664 - stable/9/sys/dev/drm2

Jean-Sebastien Pedron dumbbell at FreeBSD.org
Sun Feb 9 15:56:16 UTC 2014


Author: dumbbell
Date: Sun Feb  9 15:56:15 2014
New Revision: 261664
URL: http://svnweb.freebsd.org/changeset/base/261664

Log:
  MFC r254838:
  
  drm: In drm_gem_name_create(), verify argument before acquiring lock
  
  Submitted by:	J.R. Oldroyd <jr at opal.com>

Modified:
  stable/9/sys/dev/drm2/drm_gem_names.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/drm2/drm_gem_names.c
==============================================================================
--- stable/9/sys/dev/drm2/drm_gem_names.c	Sun Feb  9 15:54:31 2014	(r261663)
+++ stable/9/sys/dev/drm2/drm_gem_names.c	Sun Feb  9 15:56:15 2014	(r261664)
@@ -132,12 +132,12 @@ drm_gem_name_create(struct drm_gem_names
 {
 	struct drm_gem_name *np;
 
-	np = malloc(sizeof(struct drm_gem_name), M_GEM_NAMES, M_WAITOK);
-	mtx_lock(&names->lock);
 	if (*name != 0) {
-		mtx_unlock(&names->lock);
 		return (EALREADY);
 	}
+
+	np = malloc(sizeof(struct drm_gem_name), M_GEM_NAMES, M_WAITOK);
+	mtx_lock(&names->lock);
 	np->name = alloc_unr(names->unr);
 	if (np->name == -1) {
 		mtx_unlock(&names->lock);


More information about the svn-src-stable-9 mailing list