diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2024-06-13 17:33:16 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-06-14 19:19:10 +0300 |
commit | 5c1f50ab7fcb4e77a0b4ce102cfb890eef1ed8f1 (patch) | |
tree | 98355d4258f2559abf433c7a651e5cbcc7db17f5 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 3dee3b187499b317a6587e2b8e9bf3d5050e5288 (diff) | |
download | linux-5c1f50ab7fcb4e77a0b4ce102cfb890eef1ed8f1.tar.xz |
KVM: Fix a goof where kvm_create_vm() returns 0 instead of -ENOMEM
The error path for OOM when allocating buses used to return -ENOMEM using
the local variable 'r', where 'r' was initialized at the top of the
function. But a new "r = kvm_init_irq_routing(kvm);" was introduced in
the middle of the function, so now the error code is not set and it
eventually leads to a NULL dereference due to kvm_dev_ioctl_create_vm()
thinking kvm_create_vm() succeeded. Set the error code back to -ENOMEM.
Opportunistically tweak the logic to pre-set "r = -ENOMEM" immediately
before the flows that can fail due to memory allocation failure to make
it less likely that the bug recurs in the future.
Fixes: fbe4a7e881d4 ("KVM: Setup empty IRQ routing when creating a VM")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/02051e0a-09d8-49a2-917f-7c2f278a1ba1@moroto.mountain
[sean: tweak all of the "r = -ENOMEM" sites, massage changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions