AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
* Mutex stays locked on error
@ 2020-06-23 20:38 John van der Kamp
  2020-06-23 21:04 ` Alex Deucher
  0 siblings, 1 reply; 4+ messages in thread
From: John van der Kamp @ 2020-06-23 20:38 UTC (permalink / raw)
  To: amd-gfx

Try to mail the patch again, this time inline. Hope this is how you can 
process it.

John

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index dcf84a61de37..949d10ef8304 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -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
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mutex stays locked on error
  2020-06-23 20:38 Mutex stays locked on error John van der Kamp
@ 2020-06-23 21:04 ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2020-06-23 21:04 UTC (permalink / raw)
  To: John van der Kamp; +Cc: amd-gfx list

On Tue, Jun 23, 2020 at 5:02 PM John van der Kamp <sjonny@suffe.me.uk> wrote:
>
> Try to mail the patch again, this time inline. Hope this is how you can
> process it.

Can you use git to create the patch (git commit -a -s) and use git to
generate the patch (git format-patch -1) and then send that out?  Make
sure to add your Signed-off-by.  If not, I can just apply it on your
behalf if you are ok with that.

Alex

>
> John
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
> index dcf84a61de37..949d10ef8304 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
> @@ -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
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mutex stays locked on error
  2020-06-23 17:48 John van der Kamp
@ 2020-06-23 19:22 ` Nirmoy
  0 siblings, 0 replies; 4+ messages in thread
From: Nirmoy @ 2020-06-23 19:22 UTC (permalink / raw)
  To: amd-gfx

[-- Attachment #1.1: Type: text/plain, Size: 842 bytes --]

Hi John,


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

so that we can apply it.


Thanks,

Nirmoy

On 6/23/20 7:48 PM, John van der Kamp wrote:
> 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
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cnirmoy.das%40amd.com%7Ce8be7708d132495e63bf08d817a7ad86%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637285356777805685&amp;sdata=uG7iWdwahxHL06IJRPw7mnkH%2FifnTuYcxG%2BytRmnEZA%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 1888 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Mutex stays locked on error
@ 2020-06-23 17:48 John van der Kamp
  2020-06-23 19:22 ` Nirmoy
  0 siblings, 1 reply; 4+ messages in thread
From: John van der Kamp @ 2020-06-23 17:48 UTC (permalink / raw)
  To: amd-gfx


[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=amdgpu_dm_dhcp-mutex_unlock_fix.diff, Size: 603 bytes --]

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index dcf84a61de37..949d10ef8304 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -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;

[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 20:38 Mutex stays locked on error John van der Kamp
2020-06-23 21:04 ` Alex Deucher
  -- strict thread matches above, loose matches on Subject: below --
2020-06-23 17:48 John van der Kamp
2020-06-23 19:22 ` Nirmoy

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git