Commit 25c8a9e9 authored by Stefano Stabellini's avatar Stefano Stabellini Committed by Zheng Zengkai
Browse files

xen/arm: don't ignore return errors from set_phys_to_machine



stable inclusion
from stable-5.10.18
commit 0462dbbe2cab43528f943575b510625cf422921a
bugzilla: 50148

--------------------------------

commit 36bf1dfb 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: default avatarStefano Stabellini <stefano.stabellini@xilinx.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarJulien Grall <jgrall@amazon.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parent 74504a63
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -95,8 +95,10 @@ int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
	for (i = 0; i < count; i++) {
		if (map_ops[i].status)
			continue;
		set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
				    map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT);
		if (unlikely(!set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
				    map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT))) {
			return -ENOMEM;
		}
	}

	return 0;