Skip to contentSkip to conversation

drm/amdgpu: fix unload driver issue for virtual display

PATCH In review Xiangliang Yu 3 participants 3 messages Jan 19, 2017 1 message not in the archive

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

PATCH 1/1 drm/amdgpu: fix unload driver issue for virtual display

Virtual display doesn't allocate amdgpu_encoder when initializing, so will get invaild pointer if try to free amdgpu_encoder when unloading driver.

---
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -4
index 64dd266..fc12cdf 100644
@@ -634,11 +634,8 @@ static const struct drm_encoder_helper_funcs dce_virtual_encoder_helper_funcs =
 
 static void dce_virtual_encoder_destroy(struct drm_encoder *encoder)
 {
-	struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
-
-	kfree(amdgpu_encoder->enc_priv);
 	drm_encoder_cleanup(encoder);
-	kfree(amdgpu_encoder);
+	kfree(encoder);
 }
 
 static const struct drm_encoder_funcs dce_virtual_encoder_funcs = {
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1484791420-7341-1-git-send-email-Xiangliang.Yu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 19.01.2017 um 03:03 schrieb Xiangliang Yu:

Quoted 5 lines

Virtual display doesn't allocate amdgpu_encoder when initializing, so will get invaild pointer if try to free amdgpu_encoder when unloading driver.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +0 -0
index 64dd266..fc12cdf 100644
@@ -634,11 +634,8 @@ static const struct drm_encoder_helper_funcs dce_virtual_encoder_helper_funcs =
 
  static void dce_virtual_encoder_destroy(struct drm_encoder *encoder)

drivers/gpu/drm/amd/amdgpu/dce_virtual.c static const struct drm_encoder_helper_funcs dce_virtual_encoder_helper_funcs = · line 641

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -4
  {
-	struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
-
-	kfree(amdgpu_encoder->enc_priv);
  	drm_encoder_cleanup(encoder);
-	kfree(amdgpu_encoder);
+	kfree(encoder);
  }
 
  static const struct drm_encoder_funcs dce_virtual_encoder_funcs = {

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Xiangliang Yu

Virtual display doesn't allocate amdgpu_encoder when initializing, so will get invaild pointer if try to free amdgpu_encoder when unloading driver.

Quoted 24 lines
---
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -5
index 64dd266..fc12cdf 100644
@@ -634,11 +634,8 @@ static const struct drm_encoder_helper_funcs dce_virtual_encoder_helper_funcs =
 
 static void dce_virtual_encoder_destroy(struct drm_encoder *encoder)
 {
-       struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
-
-       kfree(amdgpu_encoder->enc_priv);
        drm_encoder_cleanup(encoder);
-       kfree(amdgpu_encoder);
+       kfree(encoder);
 }
 
 static const struct drm_encoder_funcs dce_virtual_encoder_funcs = {
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx