diff options
Diffstat (limited to 'NetworkPkg/IScsiDxe')
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiConfig.c | 6 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiDriver.c | 1 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiMisc.c | 5 | ||||
-rw-r--r-- | NetworkPkg/IScsiDxe/IScsiProto.c | 17 |
4 files changed, 23 insertions, 6 deletions
diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c index a82ce231e8..8015e3de53 100644 --- a/NetworkPkg/IScsiDxe/IScsiConfig.c +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c @@ -1987,7 +1987,11 @@ IScsiFormExtractConfig ( ConfigRequestHdr = HiiConstructConfigHdr (&gIScsiConfigGuid, mVendorStorageName, Private->DriverHandle);
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
ConfigRequest = AllocateZeroPool (Size);
- ASSERT (ConfigRequest != NULL);
+ if (ConfigRequest == NULL) {
+ FreePool (IfrNvData);
+ FreePool (InitiatorName);
+ return EFI_OUT_OF_RESOURCES;
+ }
AllocatedRequest = TRUE;
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
FreePool (ConfigRequestHdr);
diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c b/NetworkPkg/IScsiDxe/IScsiDriver.c index 7e7eb39ee2..c3ab2c9288 100644 --- a/NetworkPkg/IScsiDxe/IScsiDriver.c +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c @@ -323,6 +323,7 @@ IScsiSupported ( @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
@retval EFI_NOT_FOUND There is no sufficient information to establish
the iScsi session.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval EFI_DEVICE_ERROR Failed to get TCP connection device path.
@retval EFI_ACCESS_DENIED The protocol could not be removed from the Handle
because its interfaces are being used.
diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index 93c0d0c672..deebf5d9a3 100644 --- a/NetworkPkg/IScsiDxe/IScsiMisc.c +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c @@ -1006,6 +1006,7 @@ IScsiDhcpIsConfigured ( @retval EFI_SUCCESS The configuration data is retrieved.
@retval EFI_NOT_FOUND This iSCSI driver is not configured yet.
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
EFI_STATUS
@@ -1292,7 +1293,9 @@ IScsiGetConfigData ( mPrivate->PortString,
NULL
);
- ASSERT (AttemptConfigData->AttemptTitleHelpToken != 0);
+ if (AttemptConfigData->AttemptTitleHelpToken == 0) {
+ return EFI_OUT_OF_RESOURCES;
+ }
//
// Record the attempt in global link list.
diff --git a/NetworkPkg/IScsiDxe/IScsiProto.c b/NetworkPkg/IScsiDxe/IScsiProto.c index 4c4e3c28e7..c82290e55e 100644 --- a/NetworkPkg/IScsiDxe/IScsiProto.c +++ b/NetworkPkg/IScsiDxe/IScsiProto.c @@ -1,7 +1,7 @@ /** @file
The implementation of iSCSI protocol based on RFC3720.
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
@@ -731,7 +731,10 @@ IScsiPrepareLoginReq ( }
LoginReq = (ISCSI_LOGIN_REQUEST *) NetbufAllocSpace (Nbuf, sizeof (ISCSI_LOGIN_REQUEST), NET_BUF_TAIL);
- ASSERT (LoginReq != NULL);
+ if (LoginReq == NULL) {
+ NetbufFree (Nbuf);
+ return NULL;
+ }
ZeroMem (LoginReq, sizeof (ISCSI_LOGIN_REQUEST));
//
@@ -1245,7 +1248,10 @@ IScsiReceivePdu ( }
Header = NetbufAllocSpace (PduHdr, Len, NET_BUF_TAIL);
- ASSERT (Header != NULL);
+ if (Header == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ON_EXIT;
+ }
InsertTailList (NbufList, &PduHdr->List);
//
@@ -2316,7 +2322,10 @@ IScsiNewDataOutPdu ( InsertTailList (NbufList, &PduHdr->List);
DataOutHdr = (ISCSI_SCSI_DATA_OUT *) NetbufAllocSpace (PduHdr, sizeof (ISCSI_SCSI_DATA_OUT), NET_BUF_TAIL);
- ASSERT (DataOutHdr != NULL);
+ if (DataOutHdr == NULL) {
+ IScsiFreeNbufList (NbufList);
+ return NULL;
+ }
XferContext = &Tcb->XferContext;
ZeroMem (DataOutHdr, sizeof (ISCSI_SCSI_DATA_OUT));
|