!85 fix hw/usb/core.c fix buffer overflow in do_token_setup() function
Merge pull request !85 from lijiajie128/fix-usb
This commit is contained in:
commit
c30ab88d28
46
hw-usb-core-fix-buffer-overflow.patch
Normal file
46
hw-usb-core-fix-buffer-overflow.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
hw-usb-core-fix-buffer-overflow
|
||||||
|
|
||||||
|
From 18ad0451f113ffc3a2ff59c059d189cca1e42842 Mon Sep 17 00:00:00 2001
|
||||||
|
From: root <root@localhost.localdomain>
|
||||||
|
Date: Wed, 19 Aug 2020 17:04:04 +0800
|
||||||
|
Subject: [PATCH] hw/usb/core.c fix buffer overflow
|
||||||
|
|
||||||
|
Store calculated setup_len in a local variable, verify it,
|
||||||
|
and only write it to the struct (USBDevice->setup_len) in case it passed the
|
||||||
|
sanity checks.
|
||||||
|
|
||||||
|
This prevents other code (do_token_{in,out} function specifically)
|
||||||
|
from working with invalid USBDevice->setup_len values and overruning
|
||||||
|
the USBDevice->setup_buf[] buffer.
|
||||||
|
Store
|
||||||
|
Fixes: CVE-2020-14364
|
||||||
|
Signed-off-by: Gred Hoffman <kraxel@redhat.com>
|
||||||
|
---
|
||||||
|
hw/usb/core.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/hw/usb/core.c b/hw/usb/core.c
|
||||||
|
index 5abd128b..12342f13 100644
|
||||||
|
--- a/hw/usb/core.c
|
||||||
|
+++ b/hw/usb/core.c
|
||||||
|
@@ -144,6 +144,8 @@ static void do_token_setup(USBDevice *s, USBPacket *p)
|
||||||
|
"usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
|
||||||
|
s->setup_len, sizeof(s->data_buf));
|
||||||
|
p->status = USB_RET_STALL;
|
||||||
|
+ s->setup_len = 0;
|
||||||
|
+ s->setup_state = SETUP_STATE_ACK;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -277,6 +279,8 @@ static void do_parameter(USBDevice *s, USBPacket *p)
|
||||||
|
"usb_generic_handle_packet: ctrl buffer too small (%d > %zu)\n",
|
||||||
|
s->setup_len, sizeof(s->data_buf));
|
||||||
|
p->status = USB_RET_STALL;
|
||||||
|
+ s->setup_len = 0;
|
||||||
|
+ s->setup_state = SETUP_STATE_ACK;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.23.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: qemu
|
Name: qemu
|
||||||
Version: 4.1.0
|
Version: 4.1.0
|
||||||
Release: 21
|
Release: 22
|
||||||
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
|
License: GPLv2 and BSD and MIT and CC-BY
|
||||||
@ -226,6 +226,7 @@ Patch0213: target-arm-introduce-KVM_CAP_ARM_CPU_FEATURE.patch
|
|||||||
Patch0214: target-arm-Add-CPU-features-to-query-cpu-model-expan.patch
|
Patch0214: target-arm-Add-CPU-features-to-query-cpu-model-expan.patch
|
||||||
Patch0215: target-arm-Update-ID-fields.patch
|
Patch0215: target-arm-Update-ID-fields.patch
|
||||||
Patch0216: target-arm-Add-more-CPU-features.patch
|
Patch0216: target-arm-Add-more-CPU-features.patch
|
||||||
|
Patch0217: hw-usb-core-fix-buffer-overflow.patch
|
||||||
|
|
||||||
BuildRequires: flex
|
BuildRequires: flex
|
||||||
BuildRequires: bison
|
BuildRequires: bison
|
||||||
@ -572,6 +573,9 @@ getent passwd qemu >/dev/null || \
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 21 2020 Huawei Technologies Co., Ltd <lijiajie11@huawei.com>
|
||||||
|
- hw/usb/core.c: fix buffer overflow in do_token_setup function
|
||||||
|
|
||||||
* Wed Aug 19 2020 Huawei Technologies Co., Ltd <liangpeng10@huawei.com>
|
* Wed Aug 19 2020 Huawei Technologies Co., Ltd <liangpeng10@huawei.com>
|
||||||
- target-arm-convert-isar-regs-to-array.patch
|
- target-arm-convert-isar-regs-to-array.patch
|
||||||
- target-arm-parse-cpu-feature-related-options.patch
|
- target-arm-parse-cpu-feature-related-options.patch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user