mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 16:44:10 +02:00
MdeModulePkg/Usb: Make sure data from HW is no more than expected
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
70c3c2370a
commit
7fb7259fc0
@ -1009,9 +1009,12 @@ EhcMonitorAsyncRequests (
|
|||||||
ProcBuf = NULL;
|
ProcBuf = NULL;
|
||||||
|
|
||||||
if (Urb->Result == EFI_USB_NOERROR) {
|
if (Urb->Result == EFI_USB_NOERROR) {
|
||||||
ASSERT (Urb->Completed <= Urb->DataLen);
|
//
|
||||||
|
// Make sure the data received from HW is no more than expected.
|
||||||
ProcBuf = AllocatePool (Urb->Completed);
|
//
|
||||||
|
if (Urb->Completed <= Urb->DataLen) {
|
||||||
|
ProcBuf = AllocatePool (Urb->Completed);
|
||||||
|
}
|
||||||
|
|
||||||
if (ProcBuf == NULL) {
|
if (ProcBuf == NULL) {
|
||||||
EhcUpdateAsyncRequest (Ehc, Urb);
|
EhcUpdateAsyncRequest (Ehc, Urb);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The EHCI register operation routines.
|
The EHCI register operation routines.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1001,11 +1001,12 @@ UhciMonitorAsyncReqList (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Copy the data to temporary buffer if there are some
|
// Copy the data to temporary buffer if there are some
|
||||||
// data transferred. We may have zero-length packet
|
// data transferred. We may have zero-length packet.
|
||||||
|
// Make sure the data received from HW is no more than expected.
|
||||||
//
|
//
|
||||||
Data = NULL;
|
Data = NULL;
|
||||||
|
|
||||||
if (QhResult.Complete != 0) {
|
if ((QhResult.Complete != 0) && (QhResult.Complete <= AsyncReq->DataLen)) {
|
||||||
Data = AllocatePool (QhResult.Complete);
|
Data = AllocatePool (QhResult.Complete);
|
||||||
|
|
||||||
if (Data == NULL) {
|
if (Data == NULL) {
|
||||||
|
@ -1556,9 +1556,12 @@ XhcMonitorAsyncRequests (
|
|||||||
//
|
//
|
||||||
ProcBuf = NULL;
|
ProcBuf = NULL;
|
||||||
if (Urb->Result == EFI_USB_NOERROR) {
|
if (Urb->Result == EFI_USB_NOERROR) {
|
||||||
ASSERT (Urb->Completed <= Urb->DataLen);
|
//
|
||||||
|
// Make sure the data received from HW is no more than expected.
|
||||||
ProcBuf = AllocateZeroPool (Urb->Completed);
|
//
|
||||||
|
if (Urb->Completed <= Urb->DataLen) {
|
||||||
|
ProcBuf = AllocateZeroPool (Urb->Completed);
|
||||||
|
}
|
||||||
|
|
||||||
if (ProcBuf == NULL) {
|
if (ProcBuf == NULL) {
|
||||||
XhcUpdateAsyncRequest (Xhc, Urb);
|
XhcUpdateAsyncRequest (Xhc, Urb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user