Skip to contentSkip to conversation

drm/bridge: tc358767: fix EDID memory leak

PATCH In review Tomi Valkeinen 3 participants 4 messages Aug 26, 2020 – Aug 27, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge: tc358767: fix EDID memory leak

The current EDID allocated with drm_get_edid() is freed when the driver gets a new EDID, but it is not freed when the driver is removed, causing a leak.

Free the EDID (if any) on driver remove.

---
 drivers/gpu/drm/bridge/tc358767.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/tc358767.c +2 -0
index c2777b226c75..dbb18a86beaf 100644
@@ -1695,6 +1695,8 @@ static int tc_remove(struct i2c_client *client)
 	drm_bridge_remove(&tc->bridge);
 	drm_dp_aux_unregister(&tc->aux);
 
+	kfree(tc->edid);
+
 	return 0;
 }
 
Signature · 7 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Tomi Valkeinen

The current EDID allocated with drm_get_edid() is freed when the driver gets a new EDID, but it is not freed when the driver is removed, causing a leak.

Free the EDID (if any) on driver remove.

Regards
Andrzej
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to Tomi Valkeinen

Hi Tomi,

Thank you for the patch.

Quoted 16 lines · Tomi Valkeinen

The current EDID allocated with drm_get_edid() is freed when the driver gets a new EDID, but it is not freed when the driver is removed, causing a leak.

Free the EDID (if any) on driver remove.

---
 drivers/gpu/drm/bridge/tc358767.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/tc358767.c +0 -0
index c2777b226c75..dbb18a86beaf 100644

drivers/gpu/drm/bridge/tc358767.c static int tc_remove(struct i2c_client *client) · line 1699

Quoted 5 lines
drivers/gpu/drm/bridge/tc358767.c +2 -0
@@ -1695,6 +1695,8 @@ static int tc_remove(struct i2c_client *client)
 	drm_bridge_remove(&tc->bridge);
 	drm_dp_aux_unregister(&tc->aux);
 
+	kfree(tc->edid);
+

tc->edid is gone in drm-misc-next, problem solved already :-)

Quoted 2 lines
drivers/gpu/drm/bridge/tc358767.c +0 -0
 	return 0;
 }
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 24 lines · Laurent Pinchart

Hi Tomi,

Thank you for the patch.

Quoted 19 lines · Tomi Valkeinen

The current EDID allocated with drm_get_edid() is freed when the driver gets a new EDID, but it is not freed when the driver is removed, causing a leak.

Free the EDID (if any) on driver remove.

---
 drivers/gpu/drm/bridge/tc358767.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/bridge/tc358767.c +0 -0
index c2777b226c75..dbb18a86beaf 100644
@@ -1695,6 +1695,8 @@ static int tc_remove(struct i2c_client *client)
 	drm_bridge_remove(&tc->bridge);
 	drm_dp_aux_unregister(&tc->aux);
 
Quoted 4 lines

drivers/gpu/drm/bridge/tc358767.c static int tc_remove(struct i2c_client *client) · line 1699

Quoted 2 lines
drivers/gpu/drm/bridge/tc358767.c +2 -0
+	kfree(tc->edid);
+

tc->edid is gone in drm-misc-next, problem solved already :-)

Well, indeed. Should have looked at the latest... =). The leak only happens on driver remove, so I don't think it's worth sending for stable kernels.

Tomi

Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel