Blame SOURCES/kvm-hw-net-net_tx_pkt-fix-assertion-failure-in-net_tx_pk.patch

e55525
From f63534122060ee84b0fe696bef136b05e427c755 Mon Sep 17 00:00:00 2001
e55525
From: Jon Maloy <jmaloy@redhat.com>
e55525
Date: Mon, 28 Sep 2020 20:44:52 -0400
e55525
Subject: [PATCH] hw/net/net_tx_pkt: fix assertion failure in
e55525
 net_tx_pkt_add_raw_fragment()
e55525
e55525
RH-Author: Jon Maloy <jmaloy@redhat.com>
e55525
Message-id: <20200928204452.1061309-2-jmaloy@redhat.com>
e55525
Patchwork-id: 98507
e55525
O-Subject: [RHEL-7.9.z qemu-kvm-ma PATCH 1/1] hw/net/net_tx_pkt: fix assertion failure in net_tx_pkt_add_raw_fragment()
e55525
Bugzilla: 1860961
e55525
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
e55525
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
e55525
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
e55525
e55525
From: Mauro Matteo Cascella <mcascell@redhat.com>
e55525
e55525
An assertion failure issue was found in the code that processes network packets
e55525
while adding data fragments into the packet context. It could be abused by a
e55525
malicious guest to abort the QEMU process on the host. This patch replaces the
e55525
affected assert() with a conditional statement, returning false if the current
e55525
data fragment exceeds max_raw_frags.
e55525
e55525
Reported-by: Alexander Bulekov <alxndr@bu.edu>
e55525
Reported-by: Ziming Zhang <ezrakiez@gmail.com>
e55525
Reviewed-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
e55525
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
e55525
Signed-off-by: Jason Wang <jasowang@redhat.com>
e55525
e55525
(cherry picked from commit 035e69b063835a5fd23cacabd63690a3d84532a8)
e55525
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
e55525
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
e55525
---
e55525
 hw/net/net_tx_pkt.c | 5 ++++-
e55525
 1 file changed, 4 insertions(+), 1 deletion(-)
e55525
e55525
diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
e55525
index 162f802dd7..54d4c3bbd0 100644
e55525
--- a/hw/net/net_tx_pkt.c
e55525
+++ b/hw/net/net_tx_pkt.c
e55525
@@ -379,7 +379,10 @@ bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa,
e55525
     hwaddr mapped_len = 0;
e55525
     struct iovec *ventry;
e55525
     assert(pkt);
e55525
-    assert(pkt->max_raw_frags > pkt->raw_frags);
e55525
+
e55525
+    if (pkt->raw_frags >= pkt->max_raw_frags) {
e55525
+        return false;
e55525
+    }
e55525
 
e55525
     if (!len) {
e55525
         return true;
e55525
-- 
e55525
2.18.2
e55525