qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] eepro100: prevent an infinite loop over same command block
@ 2015-10-16 11:12 P J P
  2015-10-16 12:41 ` Paolo Bonzini
  0 siblings, 1 reply; 16+ messages in thread
From: P J P @ 2015-10-16 11:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: Qinghao Tang, Jason Wang

    Hello,

An infinite loop issue in hw/net/eepro100.c emulator was reported by Mr 
Qinghao Tang(CC'd here).

Below is a proposed fix patch and details about the issue.

===
>From f06497dfefabbdd6f966a5d6c177d85cd0e5ecd8 Mon Sep 17 00:00:00 2001
From: Prasad J Pandit <pjp@fedoraproject.org>
Date: Fri, 16 Oct 2015 11:33:27 +0530
Subject: eepro100: prevent an infinite loop over same command block

action_command() routine executes a chain of commands located
in the Command Block List(CBL). Each Command Block(CB) has a
link to the next CB in the list, given by 's->tx.link'.
This is used in conjunction with the base address 's->cu_base'.

An infinite loop unfolds if the 'link' to the next CB is
same as the previous one, the loop ends up executing the same
command over and over again.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
  hw/net/eepro100.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index 60333b7..d76d108 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -863,6 +863,8 @@ static void action_command(EEPRO100State *s)
          uint16_t ok_status = STATUS_OK;
          s->cb_address = s->cu_base + s->cu_offset;
          read_cb(s);
+        if (s->tx.link == s->cu_offset)
+            break;
          bit_el = ((s->tx.command & COMMAND_EL) != 0);
          bit_s = ((s->tx.command & COMMAND_S) != 0);
          bit_i = ((s->tx.command & COMMAND_I) != 0);
-- 
2.4.3
===


Thank you.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-11-20  7:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-16 11:12 [Qemu-devel] [PATCH] eepro100: prevent an infinite loop over same command block P J P
2015-10-16 12:41 ` Paolo Bonzini
2015-10-16 17:19   ` P J P
2015-10-16 21:37     ` Stefan Weil
2015-10-17 11:25       ` P J P
2015-10-17 11:35       ` Peter Maydell
2015-10-20  3:04         ` Jason Wang
2015-10-20  3:10           ` max
2015-10-20  3:02     ` Jason Wang
2015-11-03 18:49       ` P J P
2015-11-04  3:31         ` Jason Wang
2015-11-20  2:43           ` Qinghao Tang
2015-11-20  6:10             ` P J P
2015-11-20  6:29               ` Qinghao Tang
2015-11-20  7:23                 ` P J P
2015-11-20  7:47                 ` Stefan Weil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).