]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
s390/zcrypt: Improved invalid domain response handling.
authorHarald Freudenberger <freude@linux.vnet.ibm.com>
Fri, 25 Nov 2016 10:50:16 +0000 (11:50 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 14 Dec 2016 15:33:39 +0000 (16:33 +0100)
Add defines and switch case code to handle the two invalid
domain response codes better. Until now these two response
codes are handled via default resulting in -EAGAIN and
switching the processed queue to offline.  So this kind of
malformed request bounced through all suitable queues and
switched them off. Now this kind of malformed request is
just rejected with EINVAL without switching off the queue.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/crypto/zcrypt_error.h

index 09247331e9fb5ced7d9d23e7657597347ce737b3..8659788796613e27169e15d6733255476f5349db 100644 (file)
@@ -55,37 +55,39 @@ struct error_hdr {
 #define TYPE82_RSP_CODE 0x82
 #define TYPE88_RSP_CODE 0x88
 
-#define REP82_ERROR_MACHINE_FAILURE  0x10
-#define REP82_ERROR_PREEMPT_FAILURE  0x12
-#define REP82_ERROR_CHECKPT_FAILURE  0x14
-#define REP82_ERROR_MESSAGE_TYPE     0x20
-#define REP82_ERROR_INVALID_COMM_CD  0x21      /* Type 84      */
-#define REP82_ERROR_INVALID_MSG_LEN  0x23
-#define REP82_ERROR_RESERVD_FIELD    0x24      /* was 0x50     */
-#define REP82_ERROR_FORMAT_FIELD     0x29
-#define REP82_ERROR_INVALID_COMMAND  0x30
-#define REP82_ERROR_MALFORMED_MSG    0x40
-#define REP82_ERROR_RESERVED_FIELDO  0x50      /* old value    */
-#define REP82_ERROR_WORD_ALIGNMENT   0x60
-#define REP82_ERROR_MESSAGE_LENGTH   0x80
-#define REP82_ERROR_OPERAND_INVALID  0x82
-#define REP82_ERROR_OPERAND_SIZE     0x84
-#define REP82_ERROR_EVEN_MOD_IN_OPND 0x85
-#define REP82_ERROR_RESERVED_FIELD   0x88
-#define REP82_ERROR_TRANSPORT_FAIL   0x90
-#define REP82_ERROR_PACKET_TRUNCATED 0xA0
-#define REP82_ERROR_ZERO_BUFFER_LEN  0xB0
+#define REP82_ERROR_MACHINE_FAILURE        0x10
+#define REP82_ERROR_PREEMPT_FAILURE        0x12
+#define REP82_ERROR_CHECKPT_FAILURE        0x14
+#define REP82_ERROR_MESSAGE_TYPE           0x20
+#define REP82_ERROR_INVALID_COMM_CD        0x21 /* Type 84     */
+#define REP82_ERROR_INVALID_MSG_LEN        0x23
+#define REP82_ERROR_RESERVD_FIELD          0x24 /* was 0x50    */
+#define REP82_ERROR_FORMAT_FIELD           0x29
+#define REP82_ERROR_INVALID_COMMAND        0x30
+#define REP82_ERROR_MALFORMED_MSG          0x40
+#define REP82_ERROR_INVALID_DOMAIN_PRECHECK 0x42
+#define REP82_ERROR_RESERVED_FIELDO        0x50 /* old value   */
+#define REP82_ERROR_WORD_ALIGNMENT         0x60
+#define REP82_ERROR_MESSAGE_LENGTH         0x80
+#define REP82_ERROR_OPERAND_INVALID        0x82
+#define REP82_ERROR_OPERAND_SIZE           0x84
+#define REP82_ERROR_EVEN_MOD_IN_OPND       0x85
+#define REP82_ERROR_RESERVED_FIELD         0x88
+#define REP82_ERROR_INVALID_DOMAIN_PENDING  0x8A
+#define REP82_ERROR_TRANSPORT_FAIL         0x90
+#define REP82_ERROR_PACKET_TRUNCATED       0xA0
+#define REP82_ERROR_ZERO_BUFFER_LEN        0xB0
 
-#define REP88_ERROR_MODULE_FAILURE   0x10
+#define REP88_ERROR_MODULE_FAILURE         0x10
 
-#define REP88_ERROR_MESSAGE_TYPE     0x20
-#define REP88_ERROR_MESSAGE_MALFORMD 0x22
-#define REP88_ERROR_MESSAGE_LENGTH   0x23
-#define REP88_ERROR_RESERVED_FIELD   0x24
-#define REP88_ERROR_KEY_TYPE        0x34
-#define REP88_ERROR_INVALID_KEY      0x82      /* CEX2A        */
-#define REP88_ERROR_OPERAND         0x84       /* CEX2A        */
-#define REP88_ERROR_OPERAND_EVEN_MOD 0x85      /* CEX2A        */
+#define REP88_ERROR_MESSAGE_TYPE           0x20
+#define REP88_ERROR_MESSAGE_MALFORMD       0x22
+#define REP88_ERROR_MESSAGE_LENGTH         0x23
+#define REP88_ERROR_RESERVED_FIELD         0x24
+#define REP88_ERROR_KEY_TYPE               0x34
+#define REP88_ERROR_INVALID_KEY            0x82 /* CEX2A       */
+#define REP88_ERROR_OPERAND                0x84 /* CEX2A       */
+#define REP88_ERROR_OPERAND_EVEN_MOD       0x85 /* CEX2A       */
 
 static inline int convert_error(struct zcrypt_queue *zq,
                                struct ap_message *reply)
@@ -97,6 +99,8 @@ static inline int convert_error(struct zcrypt_queue *zq,
        case REP82_ERROR_OPERAND_SIZE:
        case REP82_ERROR_EVEN_MOD_IN_OPND:
        case REP88_ERROR_MESSAGE_MALFORMD:
+       case REP82_ERROR_INVALID_DOMAIN_PRECHECK:
+       case REP82_ERROR_INVALID_DOMAIN_PENDING:
        //   REP88_ERROR_INVALID_KEY            // '82' CEX2A
        //   REP88_ERROR_OPERAND                // '84' CEX2A
        //   REP88_ERROR_OPERAND_EVEN_MOD       // '85' CEX2A