diff options
| author | Mihir Joshi <mihirj@nvidia.com> | 2018-07-23 19:14:10 -0400 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-08-07 15:13:48 -0400 |
| commit | fe941adbc0463dabb94e94536dadb15f62908b0c (patch) | |
| tree | 44103ea0cef13ccf138ee0a04c5b83a0b5529ebc /security | |
| parent | 33190dee8688702984f04eb3b5eb8111225670ef (diff) | |
tlk_driver: propagate TLK error code to user-app
Bug 2186806
Tests Tested locally by turning NS DRAM ranges feature ON/OFF and testing
userspace binaries
Change-Id: I52687f865cf205d158fbf2126c1bb0833ef772d2
Signed-off-by: Mihir Joshi <mihirj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1784276
(cherry picked from commit e9dd22e4eddc803488d4f4d2315e23c1de9e2f01)
Reviewed-on: https://git-master.nvidia.com/r/1793791
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'security')
| -rw-r--r-- | security/tlk_driver/ote_comms.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/security/tlk_driver/ote_comms.c b/security/tlk_driver/ote_comms.c index 9b16565c5..71fb0f6ea 100644 --- a/security/tlk_driver/ote_comms.c +++ b/security/tlk_driver/ote_comms.c | |||
| @@ -158,6 +158,7 @@ static void do_smc(struct te_request *request, struct tlk_device *dev) | |||
| 158 | { | 158 | { |
| 159 | uint32_t smc_args; | 159 | uint32_t smc_args; |
| 160 | uint32_t smc_params = 0; | 160 | uint32_t smc_params = 0; |
| 161 | uint32_t retval = 0; | ||
| 161 | 162 | ||
| 162 | smc_args = (uintptr_t)request - (uintptr_t)dev->req_addr; | 163 | smc_args = (uintptr_t)request - (uintptr_t)dev->req_addr; |
| 163 | if (request->params) { | 164 | if (request->params) { |
| @@ -165,7 +166,23 @@ static void do_smc(struct te_request *request, struct tlk_device *dev) | |||
| 165 | (uintptr_t)request->params - (uintptr_t)dev->req_addr; | 166 | (uintptr_t)request->params - (uintptr_t)dev->req_addr; |
| 166 | } | 167 | } |
| 167 | 168 | ||
| 168 | (void)tlk_send_smc(request->type, smc_args, smc_params); | 169 | retval = tlk_send_smc(request->type, smc_args, smc_params); |
| 170 | |||
| 171 | /** | ||
| 172 | * Check for return code from TLK kernel and propagate to NS userspace | ||
| 173 | * | ||
| 174 | * Under certain situations, TLK kernel may return an error code | ||
| 175 | * _without_ updating the shared request buffer. | ||
| 176 | * | ||
| 177 | * This could give a false impression to the user-app about status of | ||
| 178 | * the request (if default value of request->result is OTE_SUCCESS). | ||
| 179 | * | ||
| 180 | * Propagate the error code to NS user-app in case of such scenario. | ||
| 181 | */ | ||
| 182 | if ((retval != OTE_SUCCESS) && (request->result == OTE_SUCCESS)) { | ||
| 183 | request->result = retval; | ||
| 184 | request->result_origin = OTE_RESULT_ORIGIN_KERNEL; | ||
| 185 | } | ||
| 169 | } | 186 | } |
| 170 | 187 | ||
| 171 | void tlk_restore_keyslots(void) | 188 | void tlk_restore_keyslots(void) |
