Skip to content

Commit b42733e

Browse files
committed
firmware: arm_ffa: Check xa_load() return value
JIRA: https://issues.redhat.com/browse/RHEL-102691 commit c00d973 Author: Cristian Marussi <cristian.marussi@arm.com> Date: Mon, 8 Jan 2024 12:34:13 +0000 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 <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20240108-ffa_fixes_6-8-v1-3-75bf7035bc50@arm.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
1 parent 81e70b0 commit b42733e

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)