|
|
03e484 |
From 1b5e283b804f9d650e1c96a3a97bd690876ac0aa Mon Sep 17 00:00:00 2001
|
|
|
03e484 |
From: Jon Maloy <jmaloy@redhat.com>
|
|
|
03e484 |
Date: Mon, 28 Sep 2020 20:05:20 -0400
|
|
|
03e484 |
Subject: [PATCH 1/2] hw/net/vmxnet_tx_pkt: fix assertion failure in
|
|
|
03e484 |
vmxnet_tx_pkt_add_raw_fragment()
|
|
|
03e484 |
|
|
|
03e484 |
RH-Author: Jon Maloy <jmaloy@redhat.com>
|
|
|
03e484 |
Message-id: <20200928200520.1045037-2-jmaloy@redhat.com>
|
|
|
03e484 |
Patchwork-id: 98500
|
|
|
03e484 |
O-Subject: [RHEL-7.9.z qemu-kvm PATCH 1/1] hw/net/vmxnet_tx_pkt: fix assertion failure in vmxnet_tx_pkt_add_raw_fragment()
|
|
|
03e484 |
Bugzilla: 1860960
|
|
|
03e484 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
03e484 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
03e484 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
03e484 |
|
|
|
03e484 |
An assertion failure issue was found in the code that processes network packets
|
|
|
03e484 |
while adding data fragments into the packet context. It could be abused by a
|
|
|
03e484 |
malicious guest to abort the QEMU process on the host. This patch replaces the
|
|
|
03e484 |
affected assert() with a conditional statement, returning false if the current
|
|
|
03e484 |
data fragment exceeds max_raw_frags.
|
|
|
03e484 |
|
|
|
03e484 |
Reported-by: Alexander Bulekov <alxndr@bu.edu>
|
|
|
03e484 |
Reported-by: Ziming Zhang <ezrakiez@gmail.com>
|
|
|
03e484 |
Reviewed-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
|
|
|
03e484 |
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
|
|
03e484 |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
03e484 |
|
|
|
03e484 |
(cherry picked from commit 035e69b063835a5fd23cacabd63690a3d84532a8)
|
|
|
03e484 |
Manually adapted since the affected function is located in a different
|
|
|
03e484 |
file and has a different name.
|
|
|
03e484 |
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
03e484 |
Signed-off-by: Jon Maloy <jmaloy.redhat.com>
|
|
|
03e484 |
---
|
|
|
03e484 |
hw/net/vmxnet_tx_pkt.c | 5 ++++-
|
|
|
03e484 |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
03e484 |
|
|
|
03e484 |
diff --git a/hw/net/vmxnet_tx_pkt.c b/hw/net/vmxnet_tx_pkt.c
|
|
|
03e484 |
index 03f34cf86f..cbb309e8a9 100644
|
|
|
03e484 |
--- a/hw/net/vmxnet_tx_pkt.c
|
|
|
03e484 |
+++ b/hw/net/vmxnet_tx_pkt.c
|
|
|
03e484 |
@@ -330,7 +330,10 @@ bool vmxnet_tx_pkt_add_raw_fragment(struct VmxnetTxPkt *pkt, hwaddr pa,
|
|
|
03e484 |
hwaddr mapped_len = 0;
|
|
|
03e484 |
struct iovec *ventry;
|
|
|
03e484 |
assert(pkt);
|
|
|
03e484 |
- assert(pkt->max_raw_frags > pkt->raw_frags);
|
|
|
03e484 |
+
|
|
|
03e484 |
+ if (pkt->raw_frags >= pkt->max_raw_frags) {
|
|
|
03e484 |
+ return false;
|
|
|
03e484 |
+ }
|
|
|
03e484 |
|
|
|
03e484 |
if (!len) {
|
|
|
03e484 |
return true;
|
|
|
03e484 |
--
|
|
|
03e484 |
2.18.2
|
|
|
03e484 |
|