Browse Source

fix(el3-spmc): validate shmem descriptor alignment

If the size of a shmem descriptor is not a multiple of 16, the
descriptor would be unusable, but the problem would be caught much
later.

Change-Id: I907f3862b55c6341e39a6b8b2e24784127230478
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
pull/1999/head
Demi Marie Obenour 2 years ago
parent
commit
dd94372d77
  1. 7
      services/std_svc/spm/el3_spmc/spmc_shared_mem.c

7
services/std_svc/spm/el3_spmc/spmc_shared_mem.c

@ -80,6 +80,13 @@ spmc_shmem_obj_alloc(struct spmc_shmem_obj_state *state, size_t desc_size)
return NULL;
}
/* Ensure that descriptor size is aligned */
if (!is_aligned(desc_size, 16)) {
WARN("%s(0x%zx) desc_size not 16-byte aligned\n",
__func__, desc_size);
return NULL;
}
obj_size = spmc_shmem_obj_size(desc_size);
/* Ensure the obj size has not overflowed. */

Loading…
Cancel
Save