Bug 1326704 - qemu-kvm: Infinite loop in gem_transmit()
Summary: qemu-kvm: Infinite loop in gem_transmit()
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1326713
TreeView+ depends on / blocked
 
Reported: 2016-04-13 10:34 UTC by Adam Mariš
Modified: 2021-03-26 18:48 UTC (History)
40 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-21 06:17:21 UTC


Attachments (Terms of Use)
Crash report (2.79 KB, text/plain)
2016-04-13 10:36 UTC, Adam Mariš
no flags Details

Description Adam Mariš 2016-04-13 10:34:49 UTC
An infinite loop vulnerability was found in gem_transmit() function.

Vulnerable code (hw/net/cadence_gem.c):

static void gem_transmit(CadenceGEMState *s)
{
unsigned desc[2];
hwaddr packet_desc_addr;
uint8_t tx_packet[2048];
uint8_t *p;
unsigned total_bytes;
…

while (tx_desc_get_used(desc) == 0) { // always be true
…

/* Last descriptor for this packet; hand the whole thing off */
if (tx_desc_get_last(desc)) {// never go to this branch
…
}

/* read next descriptor */
if (tx_desc_get_wrap(desc)) {
packet_desc_addr = s->regs[GEM_TXQBASE]; // the s->tx_desc_addr is always the same
} else {
packet_desc_addr += 8;
}
}

By setting s->tx_desc_addr's DESC_1_TX_WRAP flag and not setting DESC_1_TX_LAST flag, desc never changes and the while condition remains true, causing infinite loop.

Comment 1 Adam Mariš 2016-04-13 10:35:09 UTC
Acknowledgments:

Name: Li Qiang (Qihoo 360 Inc.)

Comment 2 Adam Mariš 2016-04-13 10:36:57 UTC
Created attachment 1146821 [details]
Crash report

Comment 4 Prasad Pandit 2016-09-21 06:08:00 UTC
Upstream fix
------------
  -> git.qemu.org/?p=qemu.git;a=commit;h=cbdab58d469cc52de30f3d0998a15d32d2fac3a0


Note You need to log in before you can comment on or make changes to this bug.