Skip to content

Commit

Permalink
drm: In drm_gem_name_create(), verify argument before acquiring lock
Browse files Browse the repository at this point in the history
Submitted by:	J.R. Oldroyd <jr@opal.com>
  • Loading branch information
dumbbell committed Aug 25, 2013
1 parent d9c0d50 commit 23e428c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/dev/drm2/drm_gem_names.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ drm_gem_name_create(struct drm_gem_names *names, void *p, uint32_t *name)
{
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);
Expand Down

0 comments on commit 23e428c

Please sign in to comment.