* [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
@ 2022-02-09 18:09 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-02-09 18:09 UTC (permalink / raw)
To: Felix Kuehling, Rajneesh Bhardwaj
Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
Daniel Vetter, Rajneesh Bhardwaj, amd-gfx, dri-devel,
kernel-janitors
If copy_to_user() fails, it returns the number of bytes remaining to
be copied but we want to return a negative error code (-EFAULT) to the
user.
Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 41f03d165bad..38a056fd0966 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
goto exit_priv;
}
- ret = copy_to_user(user_priv_data + *priv_data_offset,
- svm_priv, svm_priv_data_size);
- if (ret) {
+ if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
+ svm_priv_data_size)) {
pr_err("Failed to copy svm priv to user\n");
+ ret = -EFAULT;
goto exit_priv;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
@ 2022-02-09 18:09 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-02-09 18:09 UTC (permalink / raw)
To: Felix Kuehling, Rajneesh Bhardwaj
Cc: David Airlie, Pan, Xinhui, kernel-janitors, Rajneesh Bhardwaj,
amd-gfx, dri-devel, Alex Deucher, Christian König
If copy_to_user() fails, it returns the number of bytes remaining to
be copied but we want to return a negative error code (-EFAULT) to the
user.
Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 41f03d165bad..38a056fd0966 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
goto exit_priv;
}
- ret = copy_to_user(user_priv_data + *priv_data_offset,
- svm_priv, svm_priv_data_size);
- if (ret) {
+ if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
+ svm_priv_data_size)) {
pr_err("Failed to copy svm priv to user\n");
+ ret = -EFAULT;
goto exit_priv;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
@ 2022-02-09 18:09 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-02-09 18:09 UTC (permalink / raw)
To: Felix Kuehling, Rajneesh Bhardwaj
Cc: David Airlie, Pan, Xinhui, kernel-janitors, Rajneesh Bhardwaj,
amd-gfx, dri-devel, Daniel Vetter, Alex Deucher,
Christian König
If copy_to_user() fails, it returns the number of bytes remaining to
be copied but we want to return a negative error code (-EFAULT) to the
user.
Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 41f03d165bad..38a056fd0966 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
goto exit_priv;
}
- ret = copy_to_user(user_priv_data + *priv_data_offset,
- svm_priv, svm_priv_data_size);
- if (ret) {
+ if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
+ svm_priv_data_size)) {
pr_err("Failed to copy svm priv to user\n");
+ ret = -EFAULT;
goto exit_priv;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
2022-02-09 18:09 ` Dan Carpenter
(?)
@ 2022-02-09 20:34 ` Felix Kuehling
-1 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2022-02-09 20:34 UTC (permalink / raw)
To: Dan Carpenter, Rajneesh Bhardwaj
Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
Daniel Vetter, amd-gfx, dri-devel, kernel-janitors
On 2022-02-09 13:09, Dan Carpenter wrote:
> If copy_to_user() fails, it returns the number of bytes remaining to
> be copied but we want to return a negative error code (-EFAULT) to the
> user.
>
> Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thank you Dan. I'm applying your two patches to amd-staging-drm-next.
Regards,
Felix
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 41f03d165bad..38a056fd0966 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
> goto exit_priv;
> }
>
> - ret = copy_to_user(user_priv_data + *priv_data_offset,
> - svm_priv, svm_priv_data_size);
> - if (ret) {
> + if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
> + svm_priv_data_size)) {
> pr_err("Failed to copy svm priv to user\n");
> + ret = -EFAULT;
> goto exit_priv;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
@ 2022-02-09 20:34 ` Felix Kuehling
0 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2022-02-09 20:34 UTC (permalink / raw)
To: Dan Carpenter, Rajneesh Bhardwaj
Cc: David Airlie, Pan, Xinhui, kernel-janitors, amd-gfx, dri-devel,
Alex Deucher, Christian König
On 2022-02-09 13:09, Dan Carpenter wrote:
> If copy_to_user() fails, it returns the number of bytes remaining to
> be copied but we want to return a negative error code (-EFAULT) to the
> user.
>
> Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thank you Dan. I'm applying your two patches to amd-staging-drm-next.
Regards,
Felix
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 41f03d165bad..38a056fd0966 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
> goto exit_priv;
> }
>
> - ret = copy_to_user(user_priv_data + *priv_data_offset,
> - svm_priv, svm_priv_data_size);
> - if (ret) {
> + if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
> + svm_priv_data_size)) {
> pr_err("Failed to copy svm priv to user\n");
> + ret = -EFAULT;
> goto exit_priv;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure
@ 2022-02-09 20:34 ` Felix Kuehling
0 siblings, 0 replies; 6+ messages in thread
From: Felix Kuehling @ 2022-02-09 20:34 UTC (permalink / raw)
To: Dan Carpenter, Rajneesh Bhardwaj
Cc: David Airlie, Pan, Xinhui, kernel-janitors, amd-gfx, dri-devel,
Daniel Vetter, Alex Deucher, Christian König
On 2022-02-09 13:09, Dan Carpenter wrote:
> If copy_to_user() fails, it returns the number of bytes remaining to
> be copied but we want to return a negative error code (-EFAULT) to the
> user.
>
> Fixes: 9d5dabfeff3c ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thank you Dan. I'm applying your two patches to amd-staging-drm-next.
Regards,
Felix
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 41f03d165bad..38a056fd0966 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -3775,10 +3775,10 @@ int kfd_criu_checkpoint_svm(struct kfd_process *p,
> goto exit_priv;
> }
>
> - ret = copy_to_user(user_priv_data + *priv_data_offset,
> - svm_priv, svm_priv_data_size);
> - if (ret) {
> + if (copy_to_user(user_priv_data + *priv_data_offset, svm_priv,
> + svm_priv_data_size)) {
> pr_err("Failed to copy svm priv to user\n");
> + ret = -EFAULT;
> goto exit_priv;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-09 20:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 18:09 [PATCH] drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure Dan Carpenter
2022-02-09 18:09 ` Dan Carpenter
2022-02-09 18:09 ` Dan Carpenter
2022-02-09 20:34 ` Felix Kuehling
2022-02-09 20:34 ` Felix Kuehling
2022-02-09 20:34 ` Felix Kuehling
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.