ANDROID: virt: gunyah: Check GUNYAH_VM_SET_BOOT_CONTEXT reg upper bits
Test that the boot_context->reg provided by userspace has upper bits
cleared.
Change-Id: If96f7980b026336def24f8ff88d303d0bfa7b598
Bug: 373872273
Fixes: ed8ebd8c80c5 ("FROMLIST: virt: gunyah: Allow userspace to initialize context of primary vCPU")
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
This commit is contained in:
committed by
Treehugger Robot
parent
1a2d547525
commit
86fff7cab3
@@ -27,6 +27,8 @@
|
||||
// "From" extent for memory private to guest
|
||||
#define GUNYAH_VM_MEM_EXTENT_HOST_PRIVATE_LABEL 2
|
||||
|
||||
#define BOOT_CONTEXT_REG_MASK GUNYAH_VM_BOOT_CONTEXT_REG(0xff, 0xff)
|
||||
|
||||
static DEFINE_XARRAY(gunyah_vm_functions);
|
||||
|
||||
static void gunyah_vm_put_function(struct gunyah_vm_function *fn)
|
||||
@@ -551,6 +553,9 @@ static long gunyah_vm_set_boot_context(struct gunyah_vm *ghvm,
|
||||
u8 reg_set, reg_index; /* to check values are reasonable */
|
||||
int ret;
|
||||
|
||||
if (boot_ctx->reg & ~BOOT_CONTEXT_REG_MASK)
|
||||
return -EINVAL;
|
||||
|
||||
reg_set = (boot_ctx->reg >> GUNYAH_VM_BOOT_CONTEXT_REG_SHIFT) & 0xff;
|
||||
reg_index = boot_ctx->reg & 0xff;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user