Skip to contentSkip to conversation

drm/amdgpu: set metadata pointer to NULL after freeing.

PATCH Applied Dave Airlie 3 participants 3 messages May 3, 2016

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: set metadata pointer to NULL after freeing.

From: Dave Airlie <[email protected]>

Without this there was a double free of the metadata, which ended up freeing the fd table for me here, and taking out the machine more often than not.

I reproduced with X.org + modesetting DDX + latest llvm/mesa, also required using dri3.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
index e557fc1..7ecea83 100644
@@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
 	if (!metadata_size) {
 		if (bo->metadata_size) {
 			kfree(bo->metadata);
+			bo->metadata = NULL;
 			bo->metadata_size = 0;
 		}
 		return 0;
Signature · 6 lines
2.5.5

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Am 03.05.2016 um 04:44 schrieb Dave Airlie:

Quoted 11 lines

From: Dave Airlie <[email protected]>

Without this there was a double free of the metadata, which ended up freeing the fd table for me here, and taking out the machine more often than not.

I reproduced with X.org + modesetting DDX + latest llvm/mesa, also required using dri3.

Nice catch, patch is Reviewed-by: Christian König <[email protected]>

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index e557fc1..7ecea83 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, · line 547

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
@@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata,
  	if (!metadata_size) {
  		if (bo->metadata_size) {
  			kfree(bo->metadata);
+			bo->metadata = NULL;
  			bo->metadata_size = 0;
  		}
  		return 0;

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

Applied
#2 lore raw
Quoted 8 lines · Christian König

Am 03.05.2016 um 04:44 schrieb Dave Airlie:

Quoted 7 lines

From: Dave Airlie <[email protected]>

Without this there was a double free of the metadata, which ended up freeing the fd table for me here, and taking out the machine more often than not.

Quoted 8 lines
Quoted 5 lines

I reproduced with X.org + modesetting DDX + latest llvm/mesa, also required using dri3.

Nice catch, patch is Reviewed-by: Christian König <[email protected]>

Applied! thanks.

Alex

Quoted 17 lines
Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
index e557fc1..7ecea83 100644
@@ -541,6 +541,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void
 *metadata,
        if (!metadata_size) {
                if (bo->metadata_size) {
                        kfree(bo->metadata);
+                       bo->metadata = NULL;
                        bo->metadata_size = 0;
Quoted 8 lines
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
                }
                return 0;

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

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