linux/drivers/android
Todd Kjos 48fc8eebd1 binder: fix handling of error during copy
[ Upstream commit fe6b1869243f23a485a106c214bcfdc7aa0ed593 ]

If a memory copy function fails to copy the whole buffer,
a positive integar with the remaining bytes is returned.
In binder_translate_fd_array() this can result in an fd being
skipped due to the failed copy, but the loop continues
processing fds since the early return condition expects a
negative integer on error.

Fix by returning "ret > 0 ? -EINVAL : ret" to handle this case.

Fixes: bb4a2e48d5 ("binder: return errors from buffer copy functions")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
Link: https://lore.kernel.org/r/20211130185152.437403-2-tkjos@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27 09:19:38 +01:00
..
Kconfig
Makefile
binder.c binder: fix handling of error during copy 2022-01-27 09:19:38 +01:00
binder_alloc.c binder: fix async_free_space accounting for empty parcels 2022-01-05 12:37:46 +01:00
binder_alloc.h binder: add flag to clear buffer on txn complete 2020-12-30 11:51:35 +01:00
binder_alloc_selftest.c
binder_internal.h binder: prevent UAF for binderfs devices II 2020-03-12 13:00:17 +01:00
binder_trace.h
binderfs.c binderfs: use refcount for binder control devices too 2020-03-25 08:25:50 +01:00