Skip to content

Commit

Permalink
[S390] KVM: Read buffer overflow
Browse files Browse the repository at this point in the history
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
RoelKluin authored and Martin Schwidefsky committed Aug 7, 2009
1 parent 677c1dd commit 53cb780
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions arch/s390/kvm/sigp.c
Original file line number Diff line number Diff line change
@@ -169,7 +169,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
unsigned long *reg)
{
struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
struct kvm_s390_local_interrupt *li;
struct kvm_s390_local_interrupt *li = NULL;
struct kvm_s390_interrupt_info *inti;
int rc;
u8 tmp;
@@ -189,9 +189,10 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
return 2; /* busy */

spin_lock(&fi->lock);
li = fi->local_int[cpu_addr];
if (cpu_addr < KVM_MAX_VCPUS)
li = fi->local_int[cpu_addr];

if ((cpu_addr >= KVM_MAX_VCPUS) || (li == NULL)) {
if (li == NULL) {
rc = 1; /* incorrect state */
*reg &= SIGP_STAT_INCORRECT_STATE;
kfree(inti);

0 comments on commit 53cb780

Please sign in to comment.