Skip to contentSkip to conversation

drm/amdgpu: fix error handling in amdgpu_bo_list_get()

PATCH New Christian König 1 participant 2 messages Nov 9, 2023

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

PATCH 1/2 drm/amdgpu: fix error handling in amdgpu_bo_list_get()

We should not leak the pointer where we couldn't grab the reference on to the caller because it can be that the error handling still tries to put the reference then.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1 -0
index 4e7089a22139..8ffad1dabcb5 100644
@@ -168,6 +168,7 @@ int amdgpu_bo_list_get(struct amdgpu_fpriv *fpriv, int id,
 	}
 
 	rcu_read_unlock();
+	*result = NULL;
 	return -ENOENT;
 }
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: lower CS errors to debug severity

Otherwise userspace can spam the logs by using incorrect input values.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index aafedb344c1b..af844c98f295 100644
@@ -1442,7 +1442,7 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 		if (r == -ENOMEM)
 			DRM_ERROR("Not enough memory for command submission!\n");
 		else if (r != -ERESTARTSYS && r != -EAGAIN)
-			DRM_ERROR("Failed to process the buffer list %d!\n", r);
+			DRM_DEBUG("Failed to process the buffer list %d!\n", r);
 		goto error_fini;
 	}
 
Signature · 1 line
2.34.1