diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-11 02:47:41 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-12-11 02:47:41 -0500 |
| commit | 2fc10246766fce0b560f015e1c0b6ff29fb4ced0 (patch) | |
| tree | 0510322a0d3a8171afb1e06a7ce809f023578825 /drivers/android | |
| parent | 05eec0c931a63d8709009e3ac6a083072666fa0f (diff) | |
| parent | 50c4c4e268a2d7a3e58ebb698ac74da0de40ae36 (diff) | |
Merge 4.15-rc3 into char-misc-next
We want the fixes and changes in here for testing.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android')
| -rw-r--r-- | drivers/android/binder.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index e9d22dd85a19..85b0bb497759 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
| @@ -2009,6 +2009,26 @@ static void binder_send_failed_reply(struct binder_transaction *t, | |||
| 2009 | } | 2009 | } |
| 2010 | 2010 | ||
| 2011 | /** | 2011 | /** |
| 2012 | * binder_cleanup_transaction() - cleans up undelivered transaction | ||
| 2013 | * @t: transaction that needs to be cleaned up | ||
| 2014 | * @reason: reason the transaction wasn't delivered | ||
| 2015 | * @error_code: error to return to caller (if synchronous call) | ||
| 2016 | */ | ||
| 2017 | static void binder_cleanup_transaction(struct binder_transaction *t, | ||
| 2018 | const char *reason, | ||
| 2019 | uint32_t error_code) | ||
| 2020 | { | ||
| 2021 | if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) { | ||
| 2022 | binder_send_failed_reply(t, error_code); | ||
| 2023 | } else { | ||
| 2024 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
| 2025 | "undelivered transaction %d, %s\n", | ||
| 2026 | t->debug_id, reason); | ||
| 2027 | binder_free_transaction(t); | ||
| 2028 | } | ||
| 2029 | } | ||
| 2030 | |||
| 2031 | /** | ||
| 2012 | * binder_validate_object() - checks for a valid metadata object in a buffer. | 2032 | * binder_validate_object() - checks for a valid metadata object in a buffer. |
| 2013 | * @buffer: binder_buffer that we're parsing. | 2033 | * @buffer: binder_buffer that we're parsing. |
| 2014 | * @offset: offset in the buffer at which to validate an object. | 2034 | * @offset: offset in the buffer at which to validate an object. |
| @@ -4078,12 +4098,20 @@ retry: | |||
| 4078 | if (put_user(cmd, (uint32_t __user *)ptr)) { | 4098 | if (put_user(cmd, (uint32_t __user *)ptr)) { |
| 4079 | if (t_from) | 4099 | if (t_from) |
| 4080 | binder_thread_dec_tmpref(t_from); | 4100 | binder_thread_dec_tmpref(t_from); |
| 4101 | |||
| 4102 | binder_cleanup_transaction(t, "put_user failed", | ||
| 4103 | BR_FAILED_REPLY); | ||
| 4104 | |||
| 4081 | return -EFAULT; | 4105 | return -EFAULT; |
| 4082 | } | 4106 | } |
| 4083 | ptr += sizeof(uint32_t); | 4107 | ptr += sizeof(uint32_t); |
| 4084 | if (copy_to_user(ptr, &tr, sizeof(tr))) { | 4108 | if (copy_to_user(ptr, &tr, sizeof(tr))) { |
| 4085 | if (t_from) | 4109 | if (t_from) |
| 4086 | binder_thread_dec_tmpref(t_from); | 4110 | binder_thread_dec_tmpref(t_from); |
| 4111 | |||
| 4112 | binder_cleanup_transaction(t, "copy_to_user failed", | ||
| 4113 | BR_FAILED_REPLY); | ||
| 4114 | |||
| 4087 | return -EFAULT; | 4115 | return -EFAULT; |
| 4088 | } | 4116 | } |
| 4089 | ptr += sizeof(tr); | 4117 | ptr += sizeof(tr); |
| @@ -4153,15 +4181,9 @@ static void binder_release_work(struct binder_proc *proc, | |||
| 4153 | struct binder_transaction *t; | 4181 | struct binder_transaction *t; |
| 4154 | 4182 | ||
| 4155 | t = container_of(w, struct binder_transaction, work); | 4183 | t = container_of(w, struct binder_transaction, work); |
| 4156 | if (t->buffer->target_node && | 4184 | |
| 4157 | !(t->flags & TF_ONE_WAY)) { | 4185 | binder_cleanup_transaction(t, "process died.", |
| 4158 | binder_send_failed_reply(t, BR_DEAD_REPLY); | 4186 | BR_DEAD_REPLY); |
| 4159 | } else { | ||
| 4160 | binder_debug(BINDER_DEBUG_DEAD_TRANSACTION, | ||
| 4161 | "undelivered transaction %d\n", | ||
| 4162 | t->debug_id); | ||
| 4163 | binder_free_transaction(t); | ||
| 4164 | } | ||
| 4165 | } break; | 4187 | } break; |
| 4166 | case BINDER_WORK_RETURN_ERROR: { | 4188 | case BINDER_WORK_RETURN_ERROR: { |
| 4167 | struct binder_error *e = container_of( | 4189 | struct binder_error *e = container_of( |
