summaryrefslogtreecommitdiffstats
path: root/src/server/iscsi.c
diff options
context:
space:
mode:
authorSimon Rettberg2025-11-12 14:41:52 +0100
committerSimon Rettberg2025-12-09 15:33:21 +0100
commit518c2855d51c4c2e79ff32a25d7efd78abf57cf8 (patch)
treef3febf86880f9f80a3193d6eeac5b984a3055480 /src/server/iscsi.c
parent[SERVER] iscsi: fix typo (diff)
downloaddnbd3-518c2855d51c4c2e79ff32a25d7efd78abf57cf8.tar.gz
dnbd3-518c2855d51c4c2e79ff32a25d7efd78abf57cf8.tar.xz
dnbd3-518c2855d51c4c2e79ff32a25d7efd78abf57cf8.zip
[SERVER] iscsi: Fix handling of reason_code in logout request
Only the lower 7 bits carry the reason code, mask away highest bit.
Diffstat (limited to 'src/server/iscsi.c')
-rw-r--r--src/server/iscsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/iscsi.c b/src/server/iscsi.c
index 1b29dbe..b7aacec 100644
--- a/src/server/iscsi.c
+++ b/src/server/iscsi.c
@@ -2764,8 +2764,11 @@ static int iscsi_connection_handle_logout_req(iscsi_connection *conn, const iscs
{
iscsi_logout_req_packet *logout_req_pkt = (iscsi_logout_req_packet *) request_pdu->bhs_pkt;
- if ( (conn->state == ISCSI_CONNECT_STATE_NEW) || (logout_req_pkt->reason_code != ISCSI_LOGOUT_REQ_REASON_CODE_CLOSE_SESSION) )
+ if ( (conn->state == ISCSI_CONNECT_STATE_NEW)
+ || ((logout_req_pkt->reason_code & ISCSI_LOGOUT_REQ_REASON_CODE_MASK) != ISCSI_LOGOUT_REQ_REASON_CODE_CLOSE_SESSION) ) {
+ logadd( LOG_DEBUG1, "Invalid logout request in state %d, reason_code %d", conn->state, logout_req_pkt->reason_code );
return ISCSI_CONNECT_PDU_READ_ERR_FATAL;
+ }
iscsi_pdu CLEANUP_PDU response_pdu;
if ( !iscsi_connection_pdu_init( &response_pdu, 0, false ) )