Skip to content

Commit ee066a7

Browse files
yonghuahwenlingz
authored andcommitted
hv: fix possible buffer overflow in 'vcpu_set_eoi_exit()'
'vector' should be no greater than 0xff,else 'eoi_exit_bitmap[]' will overflow. Tracked-On: #1252 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 88eeae3 commit ee066a7

File tree

1 file changed

+1
-1
lines changed
  • hypervisor/arch/x86/guest

1 file changed

+1
-1
lines changed

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void vcpu_set_eoi_exit(struct acrn_vcpu *vcpu, uint32_t vector)
145145
pr_dbg("%s", __func__);
146146

147147
if (bitmap_test_and_set_nolock((uint16_t)(vector & 0x3fU),
148-
&(vcpu->arch.eoi_exit_bitmap[vector >> 6U]))) {
148+
&(vcpu->arch.eoi_exit_bitmap[(vector & 0xffU) >> 6U]))) {
149149
pr_warn("Duplicated vector %u vcpu%u", vector, vcpu->vcpu_id);
150150
}
151151
}

0 commit comments

Comments
 (0)