Commit 5aa71bd7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Alex Deucher
Browse files

drm/amdkfd: CRIU return -EFAULT for copy_to_user() failure



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: 9d5dabfe ("drm/amdkfd: CRIU Save Shared Virtual Memory ranges")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDavid Yat Sin <david.yatsin@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e5af61ff
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3771,10 +3771,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;
		}