thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-cadence_gem-switch-to-use-qemu_receive_packet-for-lo.patch

6e7d01
From 6f1ebcfdb92d12ef2caae0b63a3a380265cba1fa Mon Sep 17 00:00:00 2001
6e7d01
From: Jon Maloy <jmaloy@redhat.com>
6e7d01
Date: Tue, 29 Jun 2021 03:42:46 -0400
6e7d01
Subject: [PATCH 8/9] cadence_gem: switch to use qemu_receive_packet() for
6e7d01
 loopback
6e7d01
MIME-Version: 1.0
6e7d01
Content-Type: text/plain; charset=UTF-8
6e7d01
Content-Transfer-Encoding: 8bit
6e7d01
6e7d01
RH-Author: Jon Maloy <jmaloy@redhat.com>
6e7d01
Message-id: <20210629034247.3286477-9-jmaloy@redhat.com>
6e7d01
Patchwork-id: 101793
6e7d01
O-Subject: [RHEL-8.4.0.z qemu-kvm PATCH v2 8/9] cadence_gem: switch to use qemu_receive_packet() for loopback
6e7d01
Bugzilla: 1932917
6e7d01
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
6e7d01
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
6e7d01
RH-Acked-by: Thomas Huth <thuth@redhat.com>
6e7d01
6e7d01
From: Alexander Bulekov <alxndr@bu.edu>
6e7d01
6e7d01
This patch switches to use qemu_receive_packet() which can detect
6e7d01
reentrancy and return early.
6e7d01
6e7d01
This is intended to address CVE-2021-3416.
6e7d01
6e7d01
Cc: Prasad J Pandit <ppandit@redhat.com>
6e7d01
Cc: qemu-stable@nongnu.org
6e7d01
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6e7d01
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
6e7d01
Signed-off-by: Jason Wang <jasowang@redhat.com>
6e7d01
6e7d01
(cherry picked from commit e73adfbeec9d4e008630c814759052ed945c3fed)
6e7d01
Conflict: upstream commit 24d62fd5028e ("net: cadence_gem: Move tx/rx
6e7d01
packet buffert to CadenceGEMState") is missing in this version, so
6e7d01
we stick to using the original stack variable tx_packet in the calls.
6e7d01
6e7d01
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
6e7d01
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
6e7d01
---
6e7d01
 hw/net/cadence_gem.c | 4 ++--
6e7d01
 1 file changed, 2 insertions(+), 2 deletions(-)
6e7d01
6e7d01
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
6e7d01
index b8be73dc55..be7c91123b 100644
6e7d01
--- a/hw/net/cadence_gem.c
6e7d01
+++ b/hw/net/cadence_gem.c
6e7d01
@@ -1225,8 +1225,8 @@ static void gem_transmit(CadenceGEMState *s)
6e7d01
                 /* Send the packet somewhere */
6e7d01
                 if (s->phy_loop || (s->regs[GEM_NWCTRL] &
6e7d01
                                     GEM_NWCTRL_LOCALLOOP)) {
6e7d01
-                    gem_receive(qemu_get_queue(s->nic), tx_packet,
6e7d01
-                                total_bytes);
6e7d01
+                    qemu_receive_packet(qemu_get_queue(s->nic), tx_packet,
6e7d01
+                                        total_bytes);
6e7d01
                 } else {
6e7d01
                     qemu_send_packet(qemu_get_queue(s->nic), tx_packet,
6e7d01
                                      total_bytes);
6e7d01
-- 
6e7d01
2.27.0
6e7d01