Skip to contentSkip to conversation

Mutex stays locked on error

PATCH John van der Kamp 2 participants 2 messages Jun 23, 2020

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

Hello,

I was reading some code and came across this which looks like a mutex not being unlocked when an error happens. I don't know what the code does or how to test it, but it looks quite obvious. Patch is attached.

John

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +4 -2
index dcf84a61de37..949d10ef8304 100644
@@ -510,8 +510,10 @@ static ssize_t srm_data_read(struct file *filp, struct kobject *kobj, struct bin
 
 	srm = psp_get_srm(work->hdcp.config.psp.handle, &srm_version, &srm_size);
 
-	if (!srm)
-		return -EINVAL;
+	if (!srm) {
+		ret = -EINVAL;
+		goto ret;
+	}
 
 	if (pos >= srm_size)
 		ret = 0;

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

#1 lore raw

Hi John,

The patch looks correct. Can you please send a proper patch

so that we can apply it.

Thanks,

Nirmoy

Quoted 10 lines · John van der Kamp

Hello,

I was reading some code and came across this which looks like a mutex not being unlocked when an error happens. I don't know what the code does or how to test it, but it looks quite obvious. Patch is attached.

John

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cnirmoy.das%40amd.com%7Ce8be7708d132495e63bf08d817a7ad86%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637285356777805685&sdata=uG7iWdwahxHL06IJRPw7mnkH%2FifnTuYcxG%2BytRmnEZA%3D&reserved=0

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