Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad45aa9e authored by Chris Wilson's avatar Chris Wilson Committed by Dave Airlie
Browse files

drm: Potential use-after-free on error path.



Remove the member from the hash table before we free the structure!

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 005568be
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ drm_gem_init(struct drm_device *dev)

	if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START,
			DRM_FILE_PAGE_OFFSET_SIZE)) {
		drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM);
		drm_ht_remove(&mm->offset_hash);
		drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM);
		return -ENOMEM;
	}