mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-13 04:41:17 +00:00
staging: android: ion: Fix error handling in ion_query_heaps()
If the copy_to_user() fails we should unlock and return directly without updating "cnt". Also the return value should be -EFAULT instead of the number of bytes remaining. Fixes: 02b23803c6af ("staging: android: ion: Add ioctl to query available heaps") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8b77eb97f7
commit
cf55902b9c
@ -1187,8 +1187,10 @@ int ion_query_heaps(struct ion_client *client, struct ion_heap_query *query)
|
|||||||
hdata.type = heap->type;
|
hdata.type = heap->type;
|
||||||
hdata.heap_id = heap->id;
|
hdata.heap_id = heap->id;
|
||||||
|
|
||||||
ret = copy_to_user(&buffer[cnt],
|
if (copy_to_user(&buffer[cnt], &hdata, sizeof(hdata))) {
|
||||||
&hdata, sizeof(hdata));
|
ret = -EFAULT;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
cnt++;
|
cnt++;
|
||||||
if (cnt >= max_cnt)
|
if (cnt >= max_cnt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user