svn commit: r254838 - head/sys/dev/drm2

Jean-Sebastien Pedron dumbbell at FreeBSD.org
Sun Aug 25 10:04:10 UTC 2013


Author: dumbbell
Date: Sun Aug 25 10:04:10 2013
New Revision: 254838
URL: http://svnweb.freebsd.org/changeset/base/254838

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

Modified:
  head/sys/dev/drm2/drm_gem_names.c

Modified: head/sys/dev/drm2/drm_gem_names.c
==============================================================================
--- head/sys/dev/drm2/drm_gem_names.c	Sun Aug 25 10:01:59 2013	(r254837)
+++ head/sys/dev/drm2/drm_gem_names.c	Sun Aug 25 10:04:10 2013	(r254838)
@@ -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-head mailing list