Skip to content

Commit c00d973

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_ffa: Check xa_load() return value
Add a check to verify the result of xa_load() during the partition lookups done while registering/unregistering the scheduler receiver interrupt callbacks and while executing the main scheduler receiver interrupt callback handler. Fixes: 0184450 ("firmware: arm_ffa: Add schedule receiver callback mechanism") Signed-off-by: Cristian Marussi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sudeep Holla <[email protected]>
1 parent 5ff30ad commit c00d973

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,11 @@ static void __do_sched_recv_cb(u16 part_id, u16 vcpu, bool is_per_vcpu)
733733
void *cb_data;
734734

735735
partition = xa_load(&drv_info->partition_info, part_id);
736+
if (!partition) {
737+
pr_err("%s: Invalid partition ID 0x%x\n", __func__, part_id);
738+
return;
739+
}
740+
736741
read_lock(&partition->rw_lock);
737742
callback = partition->callback;
738743
cb_data = partition->cb_data;
@@ -915,6 +920,11 @@ static int ffa_sched_recv_cb_update(u16 part_id, ffa_sched_recv_cb callback,
915920
return -EOPNOTSUPP;
916921

917922
partition = xa_load(&drv_info->partition_info, part_id);
923+
if (!partition) {
924+
pr_err("%s: Invalid partition ID 0x%x\n", __func__, part_id);
925+
return -EINVAL;
926+
}
927+
918928
write_lock(&partition->rw_lock);
919929

920930
cb_valid = !!partition->callback;

0 commit comments

Comments
 (0)