diff options
author | Yonghee Han <onstudy@samsung.com> | 2016-07-27 16:42:54 +0900 |
---|---|---|
committer | Yonghee Han <onstudy@samsung.com> | 2016-07-27 00:56:08 -0700 |
commit | a03c4728275d119af5f66c4a69e8d9d5a1730031 (patch) | |
tree | 2b4ed9542884bf8b947076c55c4ef1814217cb69 /hw/net/eepro100.c | |
parent | 3158f4a51894e46ecb593bffbfd12824e1d6534a (diff) | |
download | qemu-a03c4728275d119af5f66c4a69e8d9d5a1730031.tar.gz qemu-a03c4728275d119af5f66c4a69e8d9d5a1730031.tar.bz2 qemu-a03c4728275d119af5f66c4a69e8d9d5a1730031.zip |
Imported Upstream version 2.5.1.1upstream/2.5.1.1
Change-Id: Ie290b0e68882590d8a64fab165a943940b7c98ed
Diffstat (limited to 'hw/net/eepro100.c')
-rw-r--r-- | hw/net/eepro100.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 60333b7fc..685a4781b 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -774,6 +774,11 @@ static void tx_command(EEPRO100State *s) #if 0 uint16_t tx_buffer_el = lduw_le_pci_dma(&s->dev, tbd_address + 6); #endif + if (tx_buffer_size == 0) { + /* Prevent an endless loop. */ + logout("loop in %s:%u\n", __FILE__, __LINE__); + break; + } tbd_address += 8; TRACE(RXTX, logout ("TBD (simplified mode): buffer address 0x%08x, size 0x%04x\n", @@ -855,6 +860,10 @@ static void set_multicast_list(EEPRO100State *s) static void action_command(EEPRO100State *s) { + /* The loop below won't stop if it gets special handcrafted data. + Therefore we limit the number of iterations. */ + unsigned max_loop_count = 16; + for (;;) { bool bit_el; bool bit_s; @@ -870,6 +879,13 @@ static void action_command(EEPRO100State *s) #if 0 bool bit_sf = ((s->tx.command & COMMAND_SF) != 0); #endif + + if (max_loop_count-- == 0) { + /* Prevent an endless loop. */ + logout("loop in %s:%u\n", __FILE__, __LINE__); + break; + } + s->cu_offset = s->tx.link; TRACE(OTHER, logout("val=(cu start), status=0x%04x, command=0x%04x, link=0x%08x\n", |