Re: [PATCH v5 1/6] optee: ffa: Add NULL check in optee_ffa_lend_protmem
Mostafa Saleh via OP-TEE <[email protected]> Fri, 12 Jun 2026 08:41:55 +0000
| Newsgroups | org.trustedfirmware.lists.op-tee,dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jun 08, 2026 at 03:16:49PM +0200, Jens Wiklander wrote: > On Fri, Jun 5, 2026 at 2:01 PM Sebastian Ene <[email protected]> wrote: > > > > On Tue, May 26, 2026 at 03:19:29PM +0000, Mostafa Saleh wrote: > > > Sashiko (locally) reports a possible null dereference under memory > > > pressure due to the lack of validation of the allocated pointer. > > > > > > Fix that by adding the missing check. > > > > > > Signed-off-by: Mostafa Saleh <[email protected]> > > > --- > > > drivers/tee/optee/ffa_abi.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c > > > index b4372fa268d0..633715b98625 100644 > > > --- a/drivers/tee/optee/ffa_abi.c > > > +++ b/drivers/tee/optee/ffa_abi.c > > > @@ -698,6 +698,9 @@ static int optee_ffa_lend_protmem(struct optee *optee, struct tee_shm *protmem, > > > int rc; > > > > > > mem_attr = kzalloc_objs(*mem_attr, ma_count); > > > + if (!mem_attr) > > > + return -ENOMEM; > > > + > > > for (n = 0; n < ma_count; n++) { > > > mem_attr[n].receiver = mem_attrs[n] & U16_MAX; > > > mem_attr[n].attrs = mem_attrs[n] >> 16; > > > -- > > > 2.54.0.746.g67dd491aae-goog > > > > > > > Thanks for fixing this and for including my other patches in the series > > Reviewed-by: Sebastian Ene <[email protected]> > > Please add a Fixes: tag. This patch is independent of the others in > the patch set, so if you send it alone with the Fixes: tag I'll pick > it up. I posted a v6 for this patch with the Fixes tag [1] [1] https://lore.kernel.org/all/[email protected]/ Thanks, Mostafa > > Cheers, > Jens