• Christoffer Dall's avatar
    KVM: arm64: vgic-its: Handle errors from vgic_add_lpi · 99e5e886
    Christoffer Dall authored
    During low memory conditions, we could be dereferencing a NULL pointer
    when vgic_add_lpi fails to allocate memory.
    
    Consider for example this call sequence:
    
      vgic_its_cmd_handle_mapi
          itte->irq = vgic_add_lpi(kvm, lpi_nr);
              update_lpi_config(kvm, itte->irq, NULL);
                  ret = kvm_read_guest(kvm, propbase + irq->intid
    	                                             ^^^^
    						     kaboom?
    
    Instead, return an error pointer from vgic_add_lpi and check the return
    value from its single caller.
    Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
    99e5e886
vgic-its.c 39.7 KB