diff options
author | Dave Airlie <airlied@redhat.com> | 2014-05-01 23:22:19 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-05-15 21:46:06 -0400 |
commit | ad222799bec32a2db99c12b4dfa5dc19a1f6eaac (patch) | |
tree | ae1110d8ff8d3d5692382385899fc5c5725104d7 | |
parent | 444c9a08bf787e8236e132fab7eceeb2f065aa4c (diff) |
drm: fix memory leak around mode_group (v2)
This mode group id_list was never being freed.
v2: take David's suggestion to free in minor_free.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 1 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d8b7099abece..a3fe32439a5b 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1378,6 +1378,12 @@ static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *gr | |||
1378 | return 0; | 1378 | return 0; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | void drm_mode_group_destroy(struct drm_mode_group *group) | ||
1382 | { | ||
1383 | kfree(group->id_list); | ||
1384 | group->id_list = NULL; | ||
1385 | } | ||
1386 | |||
1381 | /* | 1387 | /* |
1382 | * NOTE: Driver's shouldn't ever call drm_mode_group_init_legacy_group - it is | 1388 | * NOTE: Driver's shouldn't ever call drm_mode_group_init_legacy_group - it is |
1383 | * the drm core's responsibility to set up mode control groups. | 1389 | * the drm core's responsibility to set up mode control groups. |
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 1447b0ee3676..3727ac8bc310 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -294,6 +294,7 @@ static void drm_minor_free(struct drm_device *dev, unsigned int type) | |||
294 | 294 | ||
295 | slot = drm_minor_get_slot(dev, type); | 295 | slot = drm_minor_get_slot(dev, type); |
296 | if (*slot) { | 296 | if (*slot) { |
297 | drm_mode_group_destroy(&(*slot)->mode_group); | ||
297 | kfree(*slot); | 298 | kfree(*slot); |
298 | *slot = NULL; | 299 | *slot = NULL; |
299 | } | 300 | } |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index e55fccbe7c42..c6b9e8ab0a26 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -915,6 +915,7 @@ extern const char *drm_get_tv_subconnector_name(int val); | |||
915 | extern const char *drm_get_tv_select_name(int val); | 915 | extern const char *drm_get_tv_select_name(int val); |
916 | extern void drm_fb_release(struct drm_file *file_priv); | 916 | extern void drm_fb_release(struct drm_file *file_priv); |
917 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); | 917 | extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); |
918 | extern void drm_mode_group_destroy(struct drm_mode_group *group); | ||
918 | extern bool drm_probe_ddc(struct i2c_adapter *adapter); | 919 | extern bool drm_probe_ddc(struct i2c_adapter *adapter); |
919 | extern struct edid *drm_get_edid(struct drm_connector *connector, | 920 | extern struct edid *drm_get_edid(struct drm_connector *connector, |
920 | struct i2c_adapter *adapter); | 921 | struct i2c_adapter *adapter); |