tx_pkt: switch to use qemu_receive_packet_iov() for loopback
authorJason Wang <jasowang@redhat.com>
Wed, 24 Feb 2021 05:27:52 +0000 (13:27 +0800)
committerJason Wang <jasowang@redhat.com>
Mon, 15 Mar 2021 08:41:22 +0000 (16:41 +0800)
This patch switches to use qemu_receive_receive_iov() which can detect
reentrancy and return early.

This is intended to address CVE-2021-3416.

Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/net_tx_pkt.c

index da262edc3e95e71f2aa8a52026f9951452b6ec61..1f9aa59eca258a51c462be11488895afbce5e7d3 100644 (file)
@@ -553,7 +553,7 @@ static inline void net_tx_pkt_sendv(struct NetTxPkt *pkt,
     NetClientState *nc, const struct iovec *iov, int iov_cnt)
 {
     if (pkt->is_loopback) {
-        nc->info->receive_iov(nc, iov, iov_cnt);
+        qemu_receive_packet_iov(nc, iov, iov_cnt);
     } else {
         qemu_sendv_packet(nc, iov, iov_cnt);
     }