diff options
| author | Todd Kjos <tkjos@android.com> | 2019-03-20 18:35:45 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-21 01:50:47 -0400 |
| commit | 5997da82145bb7c9a56d834894cb81f81f219344 (patch) | |
| tree | 64e26347034da32870b33ee8aaee56402324c74f /drivers/android | |
| parent | 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff) | |
binder: fix BUG_ON found by selinux-testsuite
The selinux-testsuite found an issue resulting in a BUG_ON()
where a conditional relied on a size_t going negative when
checking the validity of a buffer offset.
Fixes: 7a67a39320df ("binder: add function to copy binder object from buffer")
Reported-by: Paul Moore <paul@paul-moore.com>
Tested-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android')
| -rw-r--r-- | drivers/android/binder.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 8685882da64c..4b9c7ca492e6 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
| @@ -2057,7 +2057,8 @@ static size_t binder_get_object(struct binder_proc *proc, | |||
| 2057 | size_t object_size = 0; | 2057 | size_t object_size = 0; |
| 2058 | 2058 | ||
| 2059 | read_size = min_t(size_t, sizeof(*object), buffer->data_size - offset); | 2059 | read_size = min_t(size_t, sizeof(*object), buffer->data_size - offset); |
| 2060 | if (read_size < sizeof(*hdr) || !IS_ALIGNED(offset, sizeof(u32))) | 2060 | if (offset > buffer->data_size || read_size < sizeof(*hdr) || |
| 2061 | !IS_ALIGNED(offset, sizeof(u32))) | ||
| 2061 | return 0; | 2062 | return 0; |
| 2062 | binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, | 2063 | binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, |
| 2063 | offset, read_size); | 2064 | offset, read_size); |
