Skip to content

Commit 55ccf71

Browse files
Stefano Stabellinigregkh
authored andcommitted
xen/arm: don't ignore return errors from set_phys_to_machine
commit 36bf1df upstream. set_phys_to_machine can fail due to lack of memory, see the kzalloc call in arch/arm/xen/p2m.c:__set_phys_to_machine_multi. Don't ignore the potential return error in set_foreign_p2m_mapping, returning it to the caller instead. This is part of XSA-361. Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Cc: stable@vger.kernel.org Reviewed-by: Julien Grall <jgrall@amazon.com> Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent feda880 commit 55ccf71

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

arch/arm/xen/p2m.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
9595
for (i = 0; i < count; i++) {
9696
if (map_ops[i].status)
9797
continue;
98-
set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
99-
map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT);
98+
if (unlikely(!set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
99+
map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT))) {
100+
return -ENOMEM;
101+
}
100102
}
101103

102104
return 0;

0 commit comments

Comments
 (0)