Commit 6b417811 authored by Pan Bian's avatar Pan Bian Committed by Thadeu Lima de Souza Cascardo

drm/amdkfd: fix improper return value on error

BugLink: http://bugs.launchpad.net/bugs/1724772

[ Upstream commit 8bf79388 ]

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: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
parent be8c5724
...@@ -739,8 +739,10 @@ int kfd_wait_on_events(struct kfd_process *p, ...@@ -739,8 +739,10 @@ int kfd_wait_on_events(struct kfd_process *p,
struct kfd_event_data event_data; struct kfd_event_data event_data;
if (copy_from_user(&event_data, &events[i], if (copy_from_user(&event_data, &events[i],
sizeof(struct kfd_event_data))) sizeof(struct kfd_event_data))) {
ret = -EFAULT;
goto fail; goto fail;
}
ret = init_event_waiter(p, &event_waiters[i], ret = init_event_waiter(p, &event_waiters[i],
event_data.event_id, i); event_data.event_id, i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment