PDU use serial32 arithmetic for cmdsn, maxcmdsn and expcmdsn.
RFC3720 says that cmdsn comparison must be done using serial32 arithmetic. This will definetly avoid a deadlock if cmdsn wraps from 2^32-1 to 0. Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
@@ -950,10 +950,10 @@ iscsi_process_login_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
|
||||
iscsi->statsn = scsi_get_uint16(&in->hdr[24]);
|
||||
|
||||
maxcmdsn = scsi_get_uint32(&in->hdr[32]);
|
||||
if (maxcmdsn > iscsi->maxcmdsn) {
|
||||
if (iscsi_serial32_compare(maxcmdsn,iscsi->maxcmdsn) > 0) {
|
||||
iscsi->maxcmdsn = maxcmdsn;
|
||||
}
|
||||
|
||||
|
||||
/* XXX here we should parse the data returned in case the target
|
||||
* renegotiated some some parameters.
|
||||
* we should also do proper handshaking if the target is not yet
|
||||
@@ -1136,7 +1136,7 @@ struct iscsi_in_pdu *in)
|
||||
uint32_t maxcmdsn;
|
||||
|
||||
maxcmdsn = scsi_get_uint32(&in->hdr[32]);
|
||||
if (maxcmdsn > iscsi->maxcmdsn) {
|
||||
if (iscsi_serial32_compare(maxcmdsn,iscsi->maxcmdsn) > 0) {
|
||||
iscsi->maxcmdsn = maxcmdsn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user