Skip to contentSkip to conversation

drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

PATCH In review Alex Deucher 3 participants 5 messages Jan 4, 2021 – Jan 14, 2021

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

PATCH 1/1 drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

Make sure the copy succeeded. Also fixes a warning.

v2: fix the error check

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +3 -1
index 455978781380..b033344c5ce2 100644
@@ -101,7 +101,9 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
 		return -EINVAL;
 
 	memset(str,  0, sizeof(str));
-	copy_from_user(str, buf, size);
+	ret = copy_from_user(str, buf, size);
+	if (ret)
+		return -EFAULT;
 
 	ret = pm_runtime_get_sync(dev->dev);
 	if (ret < 0) {
Signature · 6 lines
2.29.2

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

+ Joe

Quoted 26 lines · Alex Deucher

Make sure the copy succeeded. Also fixes a warning.

v2: fix the error check

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +3 -2
index 455978781380..b033344c5ce2 100644
@@ -101,7 +101,9 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
                return -EINVAL;
 
        memset(str,  0, sizeof(str));
-       copy_from_user(str, buf, size);
+       ret = copy_from_user(str, buf, size);
+       if (ret)
+               return -EFAULT;
 
        ret = pm_runtime_get_sync(dev->dev);
        if (ret < 0) {
--
Quoted 2 lines

2.29.2

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

#2 lore raw

[AMD Official Use Only - Internal Distribution Only]

Thanks, Alex!

Regards,
Joe

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, January 14, 2021 11:24 AM
To: amd-gfx list <[email protected]>; Su, Jinzhou (Joe) <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

+ Joe

Quoted 26 lines · Alex Deucher

Make sure the copy succeeded. Also fixes a warning.

v2: fix the error check

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +3 -2
index 455978781380..b033344c5ce2 100644
@@ -101,7 +101,9 @@ static ssize_t amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
                return -EINVAL;
 
        memset(str,  0, sizeof(str));
-       copy_from_user(str, buf, size);
+       ret = copy_from_user(str, buf, size);
+       if (ret)
+               return -EFAULT;
 
        ret = pm_runtime_get_sync(dev->dev);
        if (ret < 0) {
--
Quoted 2 lines

2.29.2

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

#3 lore raw

[AMD Public Use]

Quoted 9 lines

-----Original Message-----
From: Su, Jinzhou (Joe) <[email protected]>
Sent: Wednesday, January 13, 2021 10:27 PM
To: Alex Deucher <[email protected]>; amd-gfx list <amd- [email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

Quoted 3 lines

[AMD Official Use Only - Internal Distribution Only]

Thanks, Alex!

Can I get a Reviewed-by or Acked-by?

Thanks!

Alex

Quoted 27 lines

Regards,
Joe

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, January 14, 2021 11:24 AM
To: amd-gfx list <[email protected]>; Su, Jinzhou (Joe) <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

+ Joe

Quoted 10 lines · Alex Deucher

Make sure the copy succeeded. Also fixes a warning.

v2: fix the error check

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 20 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c

drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c static ssize_t

Quoted 4 lines

index 455978781380..b033344c5ce2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +0 -0
@@ -101,7 +101,9 @@ static ssize_t

amdgpu_securedisplay_debugfs_write(struct file *f, const char __u

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +3 -2
                return -EINVAL;
 
        memset(str,  0, sizeof(str));
-       copy_from_user(str, buf, size);
+       ret = copy_from_user(str, buf, size);
+       if (ret)
+               return -EFAULT;
 
        ret = pm_runtime_get_sync(dev->dev);
        if (ret < 0) {
--

2.29.2

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

Reviewed-by
#4 lore raw

[AMD Public Use]

Regards,
Joe

-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Thursday, January 14, 2021 12:17 PM
To: Su, Jinzhou (Joe) <[email protected]>; Alex Deucher <[email protected]>; amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

[AMD Public Use]

Quoted 9 lines

-----Original Message-----
From: Su, Jinzhou (Joe) <[email protected]>
Sent: Wednesday, January 13, 2021 10:27 PM
To: Alex Deucher <[email protected]>; amd-gfx list <amd- [email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

Quoted 3 lines

[AMD Official Use Only - Internal Distribution Only]

Thanks, Alex!

Can I get a Reviewed-by or Acked-by?

Thanks!

Alex

Quoted 27 lines

Regards,
Joe

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, January 14, 2021 11:24 AM
To: amd-gfx list <[email protected]>; Su, Jinzhou (Joe) <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: check the result of copy_from_user in secure display debugfs (v2)

+ Joe

Quoted 10 lines · Alex Deucher

Make sure the copy succeeded. Also fixes a warning.

v2: fix the error check

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 20 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c

drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c static ssize_t

Quoted 4 lines

index 455978781380..b033344c5ce2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +0 -0
@@ -101,7 +101,9 @@ static ssize_t

amdgpu_securedisplay_debugfs_write(struct file *f, const char __u

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c +3 -2
                return -EINVAL;
 
        memset(str,  0, sizeof(str));
-       copy_from_user(str, buf, size);
+       ret = copy_from_user(str, buf, size);
+       if (ret)
+               return -EFAULT;
 
        ret = pm_runtime_get_sync(dev->dev);
        if (ret < 0) {
--

2.29.2

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