Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame^] | 1 | From 023ce62f0a788ad3a8233c7a828554bceeafd031 Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Bulekov <alxndr@bu.edu> |
| 3 | Date: Mon, 1 Mar 2021 10:33:34 -0500 |
| 4 | Subject: [PATCH 08/10] pcnet: switch to use qemu_receive_packet() for loopback |
| 5 | MIME-Version: 1.0 |
| 6 | Content-Type: text/plain; charset=UTF-8 |
| 7 | Content-Transfer-Encoding: 8bit |
| 8 | |
| 9 | This patch switches to use qemu_receive_packet() which can detect |
| 10 | reentrancy and return early. |
| 11 | |
| 12 | This is intended to address CVE-2021-3416. |
| 13 | |
| 14 | Cc: Prasad J Pandit <ppandit@redhat.com> |
| 15 | Cc: qemu-stable@nongnu.org |
| 16 | Buglink: https://bugs.launchpad.net/qemu/+bug/1917085 |
| 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 [99ccfaa1edafd79f7a3a0ff7b58ae4da7c514928] |
| 22 | CVE: CVE-2021-3416 |
| 23 | |
| 24 | Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com> |
| 25 | --- |
| 26 | hw/net/pcnet.c | 2 +- |
| 27 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 28 | |
| 29 | diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c |
| 30 | index f3f18d859..dcd3fc494 100644 |
| 31 | --- a/hw/net/pcnet.c |
| 32 | +++ b/hw/net/pcnet.c |
| 33 | @@ -1250,7 +1250,7 @@ txagain: |
| 34 | if (BCR_SWSTYLE(s) == 1) |
| 35 | add_crc = !GET_FIELD(tmd.status, TMDS, NOFCS); |
| 36 | s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC; |
| 37 | - pcnet_receive(qemu_get_queue(s->nic), s->buffer, s->xmit_pos); |
| 38 | + qemu_receive_packet(qemu_get_queue(s->nic), s->buffer, s->xmit_pos); |
| 39 | s->looptest = 0; |
| 40 | } else { |
| 41 | if (s->nic) { |
| 42 | -- |
| 43 | 2.29.2 |
| 44 | |