!375 Automatically generate code patches with openeuler !199

From: @kuhnchen18
Reviewed-by: @imxcc
Signed-off-by: @imxcc
This commit is contained in:
openeuler-ci-bot 2021-09-16 07:13:21 +00:00 committed by Gitee
commit 9b3e5f5993
2 changed files with 66 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: qemu Name: qemu
Version: 4.1.0 Version: 4.1.0
Release: 81 Release: 82
Epoch: 2 Epoch: 2
Summary: QEMU is a generic and open source machine emulator and virtualizer Summary: QEMU is a generic and open source machine emulator and virtualizer
License: GPLv2 and BSD and MIT and CC-BY-SA-4.0 License: GPLv2 and BSD and MIT and CC-BY-SA-4.0
@ -558,6 +558,7 @@ Patch0545: hw-arm-smmuv3-Post-load-stage-1-configurations-to-th.patch
Patch0546: usbredir-fix-free-call.patch Patch0546: usbredir-fix-free-call.patch
Patch0547: vfio-common-Fix-incorrect-address-alignment-in-vfio_.patch Patch0547: vfio-common-Fix-incorrect-address-alignment-in-vfio_.patch
Patch0548: vfio-common-Add-address-alignment-check-in-vfio_list.patch Patch0548: vfio-common-Add-address-alignment-check-in-vfio_list.patch
Patch0549: uas-add-stream-number-sanity-checks.patch
BuildRequires: flex BuildRequires: flex
BuildRequires: gcc BuildRequires: gcc
@ -962,6 +963,9 @@ getent passwd qemu >/dev/null || \
%endif %endif
%changelog %changelog
* Thu Sep 16 2021 Chen Qun <kuhn.chenqun@huawei.com>
- uas: add stream number sanity checks.
* Tue Sep 14 2021 Chen Qun <kuhn.chenqun@huawei.com> * Tue Sep 14 2021 Chen Qun <kuhn.chenqun@huawei.com>
- vfio/common: Add address alignment check in vfio_listener_region_del - vfio/common: Add address alignment check in vfio_listener_region_del

View File

@ -0,0 +1,61 @@
From 2b0a54f7fb36836f148a3a237fd0ee99a1a300a2 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