diff options
| author | Chaithanya Lagisetty <nagachaithanya9911@gmail.com> | 2026-10-13 16:48:42 +0800 |
|---|---|---|
| committer | Huacai Chen <chenhuacai@loongson.cn> | 2026-10-13 16:48:42 +0800 |
| commit | 297ce48f3d1d8ecbc57abe780508af781819011d (patch) | |
| tree | 6fa9474939dd6141a0a680ee8d1cb1a8d9ed7630 /tools/perf/scripts/python/bin/stackcollapse-report | |
| parent | 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907 (diff) | |
LoongArch: KVM: Return the actual error code in kvm_ipi_create()
The kvm_ipi_create() function registers the IPI device on the IOCSR
bus. The error path currently discards the actual error code returned
by kvm_io_bus_register_dev() and returns -EFAULT instead:
ret = kvm_io_bus_register_dev(kvm, KVM_IOCSR_BUS, IOCSR_IPI_BASE,
IOCSR_IPI_SIZE, device);
mutex_unlock(&kvm->slots_lock);
if (ret < 0) {
kvm_pr_unimpl("%s: Initialize IOCSR dev failed, ret = %d\n",
__func__, ret);
goto err;
}
...
err:
kfree(s);
return -EFAULT;
kvm_io_bus_register_dev() fails with -ENOMEM or -ENOSPC, so userspace
creating a KVM_DEV_TYPE_LOONGARCH_IPI device is told that it passed a
bad address when the real problem is that the host is out of memory or
out of IOCSR bus slots. -EFAULT is reserved for faulting user addresses,
and the remaining -EFAULT returns in this file are get_user() failures,
where it is correct.
Free the IPI state and propagate the error directly after cleanup. The
error label has a single user, so handling the failure in place removes
the label as well. This matches kvm_eiointc_create() which already frees
its state and propagates the actual kvm_io_bus_register_dev() error code
unchanged.
Only compile-tested.
Fixes: c532de5a67a7 ("LoongArch: KVM: Add IPI device support")
Assisted-by: Cursor:claude-opus-5
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Suggested-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-report')
0 files changed, 0 insertions, 0 deletions
