!373 Automatically generate code patches with openeuler !197

From: @kuhnchen18
Reviewed-by: 
Signed-off-by:
This commit is contained in:
openeuler-ci-bot 2021-09-24 03:10:40 +00:00 committed by Gitee
commit f1d4486abb
2 changed files with 66 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: qemu
Version: 4.1.0
Release: 56
Release: 57
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
@ -332,6 +332,7 @@ 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
Patch0322: hw-arm-virt-Init-PMU-for-hotplugged-vCPU.patch
Patch0323: uas-add-stream-number-sanity-checks.patch
BuildRequires: flex
BuildRequires: bison
@ -728,6 +729,9 @@ getent passwd qemu >/dev/null || \
%endif
%changelog
* Wed Sep 15 2021 Chen Qun <kuhn.chenqun@huawei.com>
- uas: add stream number sanity checks.
* Tue Aug 31 2021 imxcc <xingchaochao@huawei.com>
- hw/arm/virt:Init PMU for hotplugged vCPU

View File

@ -0,0 +1,61 @@
From 8b9fcc2c362e88491eb1c7621797eb43d66d0193 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Wed, 18 Aug 2021 14:05:05 +0200
Subject: [PATCH] uas: add stream number sanity checks.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The device uses the guest-supplied stream number unchecked, which can
lead to guest-triggered out-of-band access to the UASDevice->data3 and
UASDevice->status3 fields. Add the missing checks.
Fixes: CVE-2021-3713
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reported-by: Chen Zhe <chenzhe@huawei.com>
Reported-by: Tan Jingguo <tanjingguo@huawei.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210818120505.1258262-2-kraxel@redhat.com>
---
hw/usb/dev-uas.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index abd8070d0c..82bbc0d083 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -827,6 +827,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
}
break;
case UAS_PIPE_ID_STATUS:
+ if (p->stream > UAS_MAX_STREAMS) {
+ goto err_stream;
+ }
if (p->stream) {
QTAILQ_FOREACH(st, &uas->results, next) {
if (st->stream == p->stream) {
@@ -854,6 +857,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
break;
case UAS_PIPE_ID_DATA_IN:
case UAS_PIPE_ID_DATA_OUT:
+ if (p->stream > UAS_MAX_STREAMS) {
+ goto err_stream;
+ }
if (p->stream) {
req = usb_uas_find_request(uas, p->stream);
} else {
@@ -889,6 +895,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
p->status = USB_RET_STALL;
break;
}
+
+err_stream:
+ error_report("%s: invalid stream %d", __func__, p->stream);
+ p->status = USB_RET_STALL;
+ return;
}
static void usb_uas_unrealize(USBDevice *dev, Error **errp)
--
2.27.0