summaryrefslogtreecommitdiff
path: root/slirp/if.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-03-05 19:50:39 +0100
committerJan Kiszka <jan.kiszka@siemens.com>2012-03-13 14:05:48 +0100
commit953e7f54e679cd40fff28e29189ed9e24bfb0758 (patch)
tree3b1632e6352987c9370546509564f177c51983a1 /slirp/if.c
parentd6536b2c971f7323e58dfbe1e6f3b7c7c0c4edf3 (diff)
downloadqemu-953e7f54e679cd40fff28e29189ed9e24bfb0758.tar.gz
qemu-953e7f54e679cd40fff28e29189ed9e24bfb0758.tar.bz2
qemu-953e7f54e679cd40fff28e29189ed9e24bfb0758.zip
slirp: Prevent recursion of if_start
if_start can be called recursively via if_encap. Avoid this as our scheme of dequeuing packets is not compatible with this. CC: Fabien Chouteau <chouteau@adacore.com> CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> CC: Stefan Weil <sw@weilnetz.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Diffstat (limited to 'slirp/if.c')
-rw-r--r--slirp/if.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/slirp/if.c b/slirp/if.c
index 14fdef1e57..f7aebe9557 100644
--- a/slirp/if.c
+++ b/slirp/if.c
@@ -163,10 +163,17 @@ void if_start(Slirp *slirp)
DEBUG_CALL("if_start");
+ if (slirp->if_start_busy) {
+ return;
+ }
+ slirp->if_start_busy = true;
+
while (slirp->if_queued) {
/* check if we can really output */
- if (!slirp_can_output(slirp->opaque))
+ if (!slirp_can_output(slirp->opaque)) {
+ slirp->if_start_busy = false;
return;
+ }
/*
* See which queue to get next packet from
@@ -221,4 +228,6 @@ void if_start(Slirp *slirp)
}
slirp->if_queued = requeued;
+
+ slirp->if_start_busy = false;
}