Skip to content

Commit cc0def5

Browse files
committed
Merge tag 'optee-fixes-for-v5.17' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes
OP-TE fixes for v5.17 - Adds error checking in optee_ffa_do_call_with_arg() - Reintroduces an accidentally lost fix for a memref size check - Uses bitmap_free() to free memory obtained with bitmap_zalloc() * tag 'optee-fixes-for-v5.17' of git://git.linaro.org/people/jens.wiklander/linux-tee: optee: add error checks in optee_ffa_do_call_with_arg() tee: optee: do not check memref size on return from Secure World optee: Use bitmap_free() to free bitmap Link: https://lore.kernel.org/r/20220126102609.GA1516258@jade Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 78b390b + 4064c46 commit cc0def5

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

drivers/tee/optee/ffa_abi.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,18 @@ static int optee_ffa_do_call_with_arg(struct tee_context *ctx,
619619
.data2 = (u32)(shm->sec_world_id >> 32),
620620
.data3 = shm->offset,
621621
};
622-
struct optee_msg_arg *arg = tee_shm_get_va(shm, 0);
623-
unsigned int rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
624-
struct optee_msg_arg *rpc_arg = tee_shm_get_va(shm, rpc_arg_offs);
622+
struct optee_msg_arg *arg;
623+
unsigned int rpc_arg_offs;
624+
struct optee_msg_arg *rpc_arg;
625+
626+
arg = tee_shm_get_va(shm, 0);
627+
if (IS_ERR(arg))
628+
return PTR_ERR(arg);
629+
630+
rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
631+
rpc_arg = tee_shm_get_va(shm, rpc_arg_offs);
632+
if (IS_ERR(rpc_arg))
633+
return PTR_ERR(rpc_arg);
625634

626635
return optee_ffa_yielding_call(ctx, &data, rpc_arg);
627636
}

drivers/tee/optee/notif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ int optee_notif_init(struct optee *optee, u_int max_key)
121121

122122
void optee_notif_uninit(struct optee *optee)
123123
{
124-
kfree(optee->notif.bitmap);
124+
bitmap_free(optee->notif.bitmap);
125125
}

drivers/tee/optee/smc_abi.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,6 @@ static int from_msg_param_tmp_mem(struct tee_param *p, u32 attr,
7575
p->u.memref.shm_offs = mp->u.tmem.buf_ptr - pa;
7676
p->u.memref.shm = shm;
7777

78-
/* Check that the memref is covered by the shm object */
79-
if (p->u.memref.size) {
80-
size_t o = p->u.memref.shm_offs +
81-
p->u.memref.size - 1;
82-
83-
rc = tee_shm_get_pa(shm, o, NULL);
84-
if (rc)
85-
return rc;
86-
}
87-
8878
return 0;
8979
}
9080

0 commit comments

Comments
 (0)