From 3e52ea57180471250ba4bb426527ab9bbad4e5a4 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 8 Nov 2021 13:55:15 +0000
Subject: [PATCH] drm: Fix double free from checking if gamma lut has
 been updated

The code falls through to "fail" under all conditions, so there is no
need for the drm_property_blob_put if the gamma lut hasn't been changed.
Fixes: 9cca26674a2b "drm: Check whether the gamma lut has changed before updating"

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/drm_color_mgmt.c | 2 --
 1 file changed, 2 deletions(-)

--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -330,8 +330,6 @@ static int drm_crtc_legacy_gamma_set(str
 	    memcmp(crtc_state->gamma_lut->data, blob_data, blob->length))
 		replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
 					      use_gamma_lut ? blob : NULL);
-	else
-		drm_property_blob_put(blob);
 	crtc_state->color_mgmt_changed |= replaced;
 
 	ret = drm_atomic_commit(state);
