From c837e689ec38cca4e3e2e357cd7191f712c48665 Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Thu, 22 Jul 2021 09:27:56 +0200 Subject: [PATCH 1/3] usbredir: fix free call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit data might point into the middle of a larger buffer, there is a separate free_on_destroy pointer passed into bufp_alloc() to handle that. It is only used in the normal workflow though, not when dropping packets due to the queue being full. Fix that. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/491 Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Message-Id: <20210722072756.647673-1-kraxel@redhat.com> Signed-off-by: imxcc --- usbredir-fix-free-call.patch | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 usbredir-fix-free-call.patch diff --git a/usbredir-fix-free-call.patch b/usbredir-fix-free-call.patch new file mode 100644 index 0000000..f223db9 --- /dev/null +++ b/usbredir-fix-free-call.patch @@ -0,0 +1,38 @@ +From 954de76bad35dc345445d2772b09a1615b315eab Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Thu, 22 Jul 2021 09:27:56 +0200 +Subject: [PATCH] usbredir: fix free call +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +data might point into the middle of a larger buffer, there is a separate +free_on_destroy pointer passed into bufp_alloc() to handle that. It is +only used in the normal workflow though, not when dropping packets due +to the queue being full. Fix that. + +Resolves: https://gitlab.com/qemu-project/qemu/-/issues/491 +Signed-off-by: Gerd Hoffmann +Reviewed-by: Marc-André Lureau +Message-Id: <20210722072756.647673-1-kraxel@redhat.com> +Signed-off-by: imxcc +--- + hw/usb/redirect.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c +index 998fc6e4b0..87338f76da 100644 +--- a/hw/usb/redirect.c ++++ b/hw/usb/redirect.c +@@ -459,7 +459,7 @@ static int bufp_alloc(USBRedirDevice *dev, uint8_t *data, uint16_t len, + if (dev->endpoint[EP2I(ep)].bufpq_dropping_packets) { + if (dev->endpoint[EP2I(ep)].bufpq_size > + dev->endpoint[EP2I(ep)].bufpq_target_size) { +- free(data); ++ free(free_on_destroy); + return -1; + } + dev->endpoint[EP2I(ep)].bufpq_dropping_packets = 0; +-- +2.27.0 + -- Gitee From 51a6e68cb5a1d3e7b87a2de30e007362c2483d24 Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Mon, 16 Aug 2021 16:27:29 +0800 Subject: [PATCH 2/3] spec: Update patch and changelog with !184 fix CVE-2021-3682 #I45H4H !184 usbredir: fix free call Signed-off-by: Chen Qun --- qemu.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qemu.spec b/qemu.spec index 58f000e..4fb468f 100644 --- a/qemu.spec +++ b/qemu.spec @@ -330,6 +330,7 @@ Patch0317: target-i386-Add-new-bit-definitions-of-MSR_IA32_ARCH.patch Patch0318: target-i386-Add-missed-security-features-to-Cooperla.patch Patch0319: target-i386-add-PSCHANGE_NO-bit-for-the-ARCH_CAPABIL.patch Patch0320: target-i386-Export-TAA_NO-bit-to-guests.patch +Patch0321: usbredir-fix-free-call.patch BuildRequires: flex BuildRequires: bison @@ -717,6 +718,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Mon Aug 16 2021 Chen Qun +- usbredir: fix free call + * Fri Jul 16 2021 Chen Qun - x86: Intel AVX512_BF16 feature enabling - i386: Add MSR feature bit for MDS-NO -- Gitee From e98f83ffa374ec63a588607b5d54d51d9c9045d0 Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Mon, 16 Aug 2021 16:27:29 +0800 Subject: [PATCH 3/3] spec: Update release version with !184 increase release verison by one Signed-off-by: Chen Qun --- qemu.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu.spec b/qemu.spec index 4fb468f..fb2ac93 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 4.1.0 -Release: 53 +Release: 54 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 -- Gitee