Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame^] | 1 | From ecf7e62bb2cb02c9bd40082504ae376f3e19ffd2 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Bulekov <alxndr@bu.edu> |
| 3 | Date: Mon, 1 Mar 2021 14:33:43 -0500 |
| 4 | Subject: [PATCH 09/10] cadence_gem: switch to use qemu_receive_packet() for |
| 5 | loopback |
| 6 | MIME-Version: 1.0 |
| 7 | Content-Type: text/plain; charset=UTF-8 |
| 8 | Content-Transfer-Encoding: 8bit |
| 9 | |
| 10 | This patch switches to use qemu_receive_packet() which can detect |
| 11 | reentrancy and return early. |
| 12 | |
| 13 | This is intended to address CVE-2021-3416. |
| 14 | |
| 15 | Cc: Prasad J Pandit <ppandit@redhat.com> |
| 16 | Cc: qemu-stable@nongnu.org |
| 17 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
| 18 | Signed-off-by: Alexander Bulekov <alxndr@bu.edu> |
| 19 | Signed-off-by: Jason Wang <jasowang@redhat.com> |
| 20 | |
| 21 | Upstream-Status: Backport [e73adfbeec9d4e008630c814759052ed945c3fed] |
| 22 | CVE: CVE-2021-3416 |
| 23 | |
| 24 | Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> |
| 25 | --- |
| 26 | hw/net/cadence_gem.c | 4 ++-- |
| 27 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 28 | |
| 29 | diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c |
| 30 | index 7a534691f..43b760e3f 100644 |
| 31 | --- a/hw/net/cadence_gem.c |
| 32 | +++ b/hw/net/cadence_gem.c |
| 33 | @@ -1275,8 +1275,8 @@ static void gem_transmit(CadenceGEMState *s) |
| 34 | /* Send the packet somewhere */ |
| 35 | if (s->phy_loop || (s->regs[GEM_NWCTRL] & |
| 36 | GEM_NWCTRL_LOCALLOOP)) { |
| 37 | - gem_receive(qemu_get_queue(s->nic), s->tx_packet, |
| 38 | - total_bytes); |
| 39 | + qemu_receive_packet(qemu_get_queue(s->nic), s->tx_packet, |
| 40 | + total_bytes); |
| 41 | } else { |
| 42 | qemu_send_packet(qemu_get_queue(s->nic), s->tx_packet, |
| 43 | total_bytes); |
| 44 | -- |
| 45 | 2.29.2 |
| 46 | |