Revision: 16750
http://sourceforge.net/p/edk2/code/16750
Author: tye1
Date: 2015-02-04 08:53:56 +0000 (Wed, 04 Feb 2015)
Log Message:
-----------
Enhance the parameter check to avoid potential issue in negotiation.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ye Ting <[email protected]>
Reviewed-by: Tian Feng <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
Modified: trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
2015-02-04 08:32:52 UTC (rev 16749)
+++ trunk/edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiProto.c
2015-02-04 08:53:56 UTC (rev 16750)
@@ -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 - 2015, 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
@@ -1225,13 +1225,15 @@
//
// InitialR2T, result function is OR.
//
- Value = IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_INITIAL_R2T);
- if (Value == NULL) {
- goto ON_ERROR;
+ if (!Session->InitialR2T) {
+ Value = IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_INITIAL_R2T);
+ if (Value == NULL) {
+ goto ON_ERROR;
+ }
+
+ Session->InitialR2T = (BOOLEAN) (AsciiStrCmp (Value, "Yes") == 0);
}
- Session->InitialR2T = (BOOLEAN) (Session->InitialR2T || (AsciiStrCmp (Value,
"Yes") == 0));
-
//
// ImmediateData, result function is AND.
//
@@ -1240,7 +1242,7 @@
goto ON_ERROR;
}
- Session->ImmediateData = (BOOLEAN) (Session->ImmediateData && (AsciiStrCmp
(Value, "Yes") == 0));
+ Session->ImmediateData = (BOOLEAN) (Session->ImmediateData && (BOOLEAN)
(AsciiStrCmp (Value, "Yes") == 0));
//
// MaxRecvDataSegmentLength is declarative.
@@ -1265,14 +1267,16 @@
// ImmediateData=No.
// This Key/Value is negotiation type.
//
- Value = IScsiGetValueByKeyFromList (KeyValueList,
ISCSI_KEY_FIRST_BURST_LENGTH);
- if (Value == NULL) {
- goto ON_ERROR;
+ if (!(Session->InitialR2T && !Session->ImmediateData)) {
+ Value = IScsiGetValueByKeyFromList (KeyValueList,
ISCSI_KEY_FIRST_BURST_LENGTH);
+ if (Value == NULL) {
+ goto ON_ERROR;
+ }
+
+ NumericValue = AsciiStrDecimalToUintn (Value);
+ Session->FirstBurstLength = (UINT32) MIN (Session->FirstBurstLength,
NumericValue);
}
- NumericValue = AsciiStrDecimalToUintn (Value);
- Session->FirstBurstLength = (UINT32) MIN (Session->FirstBurstLength,
NumericValue);
-
//
// MaxConnections, result function is Minimum.
//
@@ -1360,7 +1364,7 @@
Session->MaxOutstandingR2T = (UINT16) MIN (Session->MaxOutstandingR2T,
NumericValue);
//
- // Remove declarative key-value paris if any.
+ // Remove declarative key-value pairs, if any.
//
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_SESSION_TYPE);
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_TARGET_ALIAS);
@@ -1368,9 +1372,17 @@
//
// Remove the key-value that may not needed for result function is OR.
//
+ IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_INITIAL_R2T);
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_DATA_PDU_IN_ORDER);
IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_DATA_SEQUENCE_IN_ORDER);
+ //
+ // Remove irrelevant parameter, if any.
+ //
+ if (Session->InitialR2T && !Session->ImmediateData) {
+ IScsiGetValueByKeyFromList (KeyValueList, ISCSI_KEY_FIRST_BURST_LENGTH);
+ }
+
if (IsListEmpty (KeyValueList)) {
//
// Succeed if no more keys in the list.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits