Skip to content

Commit 8b2522e

Browse files
SinkFindergregkh
authored andcommitted
drm/amdkfd: fix improper return value on error
[ Upstream commit 8bf793883da213864efc50c274d2b38ec0ca58b2 ] In function kfd_wait_on_events(), when the call to copy_from_user() fails, the value of return variable ret is 0. 0 indicates success, which is inconsistent with the execution status. This patch fixes the bug by assigning "-EFAULT" to ret when copy_from_user() returns an unexpected value. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bf184dd commit 8b2522e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/amd/amdkfd/kfd_events.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,10 @@ int kfd_wait_on_events(struct kfd_process *p,
739739
struct kfd_event_data event_data;
740740

741741
if (copy_from_user(&event_data, &events[i],
742-
sizeof(struct kfd_event_data)))
742+
sizeof(struct kfd_event_data))) {
743+
ret = -EFAULT;
743744
goto fail;
745+
}
744746

745747
ret = init_event_waiter(p, &event_waiters[i],
746748
event_data.event_id, i);

0 commit comments

Comments
 (0)