From f8fe5726b0423ac279690295ebf5f1b61395cc0a 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..71abcc8 --- /dev/null +++ b/usbredir-fix-free-call.patch @@ -0,0 +1,38 @@ +From 22b89bb0b9470ea3fee4bf7e55c37e99e49e72ce 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 a26e0eaabedf3587cd6e519e82cb037e625f45b5 Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Mon, 16 Aug 2021 11:29:38 +0800 Subject: [PATCH 2/3] spec: Update patch and changelog with !186 fix CVE-2021-3682 #I45H4H !186 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 0765889..e5c86f7 100644 --- a/qemu.spec +++ b/qemu.spec @@ -248,6 +248,7 @@ Patch0235: ide-ahci-add-check-to-avoid-null-dereference-CVE-201.patch Patch0236: hw-intc-arm_gic-Fix-interrupt-ID-in-GICD_SGIR-regist.patch Patch0237: usb-limit-combined-packets-to-1-MiB-CVE-2021-3527.patch Patch0238: hw-net-rocker_of_dpa-fix-double-free-bug-of-rocker-d.patch +Patch0239: usbredir-fix-free-call.patch BuildRequires: flex BuildRequires: bison @@ -593,6 +594,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Mon Aug 16 2021 Chen Qun +- usbredir: fix free call + * Tue Jul 13 2021 Chen Qun - hw/net/rocker_of_dpa: fix double free bug of rocker device -- Gitee From 064b5930eec79d3ac82e607930ee314ab1c3df2f Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Mon, 16 Aug 2021 11:30:04 +0800 Subject: [PATCH 3/3] spec: Update release version with !186 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 e5c86f7..dd12df8 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,6 +1,6 @@ Name: qemu Version: 4.1.0 -Release: 44 +Release: 45 Epoch: 2 Summary: QEMU is a generic and open source machine emulator and virtualizer License: GPLv2 and BSD and MIT and CC-BY -- Gitee