Skip to contentSkip to conversation

drm/amdgpu: fix double reference dropping

PATCH Superseded Pan Bian 2 participants 2 messages Nov 6, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Pan Bian

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix double reference dropping

After dropping the reference of object fence in the loop, it should be set to NULL to protecting dropping its reference again outside the loop.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +1 -0
index 649e68c4479b..3174093f35f3 100644
@@ -47,6 +47,7 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
 		if (r)
 			goto exit_do_move;
 		dma_fence_put(fence);
+		fence = NULL;
 	}
 	end_jiffies = jiffies;
 	r = jiffies_to_msecs(end_jiffies - start_jiffies);
Signature · 1 line
2.7.4
maintainer NAK
#1 lore raw

Am 06.11.19 um 10:53 schrieb Pan Bian:

Quoted 2 lines

After dropping the reference of object fence in the loop, it should be set to NULL to protecting dropping its reference again outside the loop.

NAK, the actual bug is that we shouldn't drop the fence outside the loop in the first place.

Just move the dma_fence_put(fence); two lines up and drop initializing fence to NULL.

Regards,
Christian.

Quoted 11 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +0 -0
index 649e68c4479b..3174093f35f3 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size, · line 53

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +1 -0
@@ -47,6 +47,7 @@ static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned size,
  		if (r)
  			goto exit_do_move;
  		dma_fence_put(fence);
+		fence = NULL;
  	}
  	end_jiffies = jiffies;
  	r = jiffies_to_msecs(end_jiffies - start_jiffies);

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