diff options
Diffstat (limited to 'drivers/s390/crypto')
-rw-r--r-- | drivers/s390/crypto/zcrypt_cex2a.c | 10 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcica.c | 10 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcicc.c | 10 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcixcc.c | 10 |
4 files changed, 28 insertions, 12 deletions
diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c index 54f4cbc3be9e..326ea08f67c9 100644 --- a/drivers/s390/crypto/zcrypt_cex2a.c +++ b/drivers/s390/crypto/zcrypt_cex2a.c | |||
@@ -264,17 +264,21 @@ static void zcrypt_cex2a_receive(struct ap_device *ap_dev, | |||
264 | .type = TYPE82_RSP_CODE, | 264 | .type = TYPE82_RSP_CODE, |
265 | .reply_code = REP82_ERROR_MACHINE_FAILURE, | 265 | .reply_code = REP82_ERROR_MACHINE_FAILURE, |
266 | }; | 266 | }; |
267 | struct type80_hdr *t80h = reply->message; | 267 | struct type80_hdr *t80h; |
268 | int length; | 268 | int length; |
269 | 269 | ||
270 | /* Copy the reply message to the request message buffer. */ | 270 | /* Copy the reply message to the request message buffer. */ |
271 | if (IS_ERR(reply)) | 271 | if (IS_ERR(reply)) { |
272 | memcpy(msg->message, &error_reply, sizeof(error_reply)); | 272 | memcpy(msg->message, &error_reply, sizeof(error_reply)); |
273 | else if (t80h->type == TYPE80_RSP_CODE) { | 273 | goto out; |
274 | } | ||
275 | t80h = reply->message; | ||
276 | if (t80h->type == TYPE80_RSP_CODE) { | ||
274 | length = min(CEX2A_MAX_RESPONSE_SIZE, (int) t80h->len); | 277 | length = min(CEX2A_MAX_RESPONSE_SIZE, (int) t80h->len); |
275 | memcpy(msg->message, reply->message, length); | 278 | memcpy(msg->message, reply->message, length); |
276 | } else | 279 | } else |
277 | memcpy(msg->message, reply->message, sizeof error_reply); | 280 | memcpy(msg->message, reply->message, sizeof error_reply); |
281 | out: | ||
278 | complete((struct completion *) msg->private); | 282 | complete((struct completion *) msg->private); |
279 | } | 283 | } |
280 | 284 | ||
diff --git a/drivers/s390/crypto/zcrypt_pcica.c b/drivers/s390/crypto/zcrypt_pcica.c index 12da4815ba8e..17ba81b58c78 100644 --- a/drivers/s390/crypto/zcrypt_pcica.c +++ b/drivers/s390/crypto/zcrypt_pcica.c | |||
@@ -247,17 +247,21 @@ static void zcrypt_pcica_receive(struct ap_device *ap_dev, | |||
247 | .type = TYPE82_RSP_CODE, | 247 | .type = TYPE82_RSP_CODE, |
248 | .reply_code = REP82_ERROR_MACHINE_FAILURE, | 248 | .reply_code = REP82_ERROR_MACHINE_FAILURE, |
249 | }; | 249 | }; |
250 | struct type84_hdr *t84h = reply->message; | 250 | struct type84_hdr *t84h; |
251 | int length; | 251 | int length; |
252 | 252 | ||
253 | /* Copy the reply message to the request message buffer. */ | 253 | /* Copy the reply message to the request message buffer. */ |
254 | if (IS_ERR(reply)) | 254 | if (IS_ERR(reply)) { |
255 | memcpy(msg->message, &error_reply, sizeof(error_reply)); | 255 | memcpy(msg->message, &error_reply, sizeof(error_reply)); |
256 | else if (t84h->code == TYPE84_RSP_CODE) { | 256 | goto out; |
257 | } | ||
258 | t84h = reply->message; | ||
259 | if (t84h->code == TYPE84_RSP_CODE) { | ||
257 | length = min(PCICA_MAX_RESPONSE_SIZE, (int) t84h->len); | 260 | length = min(PCICA_MAX_RESPONSE_SIZE, (int) t84h->len); |
258 | memcpy(msg->message, reply->message, length); | 261 | memcpy(msg->message, reply->message, length); |
259 | } else | 262 | } else |
260 | memcpy(msg->message, reply->message, sizeof error_reply); | 263 | memcpy(msg->message, reply->message, sizeof error_reply); |
264 | out: | ||
261 | complete((struct completion *) msg->private); | 265 | complete((struct completion *) msg->private); |
262 | } | 266 | } |
263 | 267 | ||
diff --git a/drivers/s390/crypto/zcrypt_pcicc.c b/drivers/s390/crypto/zcrypt_pcicc.c index 779952cb19fc..f4b0c4795434 100644 --- a/drivers/s390/crypto/zcrypt_pcicc.c +++ b/drivers/s390/crypto/zcrypt_pcicc.c | |||
@@ -447,19 +447,23 @@ static void zcrypt_pcicc_receive(struct ap_device *ap_dev, | |||
447 | .type = TYPE82_RSP_CODE, | 447 | .type = TYPE82_RSP_CODE, |
448 | .reply_code = REP82_ERROR_MACHINE_FAILURE, | 448 | .reply_code = REP82_ERROR_MACHINE_FAILURE, |
449 | }; | 449 | }; |
450 | struct type86_reply *t86r = reply->message; | 450 | struct type86_reply *t86r; |
451 | int length; | 451 | int length; |
452 | 452 | ||
453 | /* Copy the reply message to the request message buffer. */ | 453 | /* Copy the reply message to the request message buffer. */ |
454 | if (IS_ERR(reply)) | 454 | if (IS_ERR(reply)) { |
455 | memcpy(msg->message, &error_reply, sizeof(error_reply)); | 455 | memcpy(msg->message, &error_reply, sizeof(error_reply)); |
456 | else if (t86r->hdr.type == TYPE86_RSP_CODE && | 456 | goto out; |
457 | } | ||
458 | t86r = reply->message; | ||
459 | if (t86r->hdr.type == TYPE86_RSP_CODE && | ||
457 | t86r->cprb.cprb_ver_id == 0x01) { | 460 | t86r->cprb.cprb_ver_id == 0x01) { |
458 | length = sizeof(struct type86_reply) + t86r->length - 2; | 461 | length = sizeof(struct type86_reply) + t86r->length - 2; |
459 | length = min(PCICC_MAX_RESPONSE_SIZE, length); | 462 | length = min(PCICC_MAX_RESPONSE_SIZE, length); |
460 | memcpy(msg->message, reply->message, length); | 463 | memcpy(msg->message, reply->message, length); |
461 | } else | 464 | } else |
462 | memcpy(msg->message, reply->message, sizeof error_reply); | 465 | memcpy(msg->message, reply->message, sizeof error_reply); |
466 | out: | ||
463 | complete((struct completion *) msg->private); | 467 | complete((struct completion *) msg->private); |
464 | } | 468 | } |
465 | 469 | ||
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c index d8ad36f81540..e7a1e22e77ac 100644 --- a/drivers/s390/crypto/zcrypt_pcixcc.c +++ b/drivers/s390/crypto/zcrypt_pcixcc.c | |||
@@ -635,13 +635,16 @@ static void zcrypt_pcixcc_receive(struct ap_device *ap_dev, | |||
635 | }; | 635 | }; |
636 | struct response_type *resp_type = | 636 | struct response_type *resp_type = |
637 | (struct response_type *) msg->private; | 637 | (struct response_type *) msg->private; |
638 | struct type86x_reply *t86r = reply->message; | 638 | struct type86x_reply *t86r; |
639 | int length; | 639 | int length; |
640 | 640 | ||
641 | /* Copy the reply message to the request message buffer. */ | 641 | /* Copy the reply message to the request message buffer. */ |
642 | if (IS_ERR(reply)) | 642 | if (IS_ERR(reply)) { |
643 | memcpy(msg->message, &error_reply, sizeof(error_reply)); | 643 | memcpy(msg->message, &error_reply, sizeof(error_reply)); |
644 | else if (t86r->hdr.type == TYPE86_RSP_CODE && | 644 | goto out; |
645 | } | ||
646 | t86r = reply->message; | ||
647 | if (t86r->hdr.type == TYPE86_RSP_CODE && | ||
645 | t86r->cprbx.cprb_ver_id == 0x02) { | 648 | t86r->cprbx.cprb_ver_id == 0x02) { |
646 | switch (resp_type->type) { | 649 | switch (resp_type->type) { |
647 | case PCIXCC_RESPONSE_TYPE_ICA: | 650 | case PCIXCC_RESPONSE_TYPE_ICA: |
@@ -660,6 +663,7 @@ static void zcrypt_pcixcc_receive(struct ap_device *ap_dev, | |||
660 | } | 663 | } |
661 | } else | 664 | } else |
662 | memcpy(msg->message, reply->message, sizeof error_reply); | 665 | memcpy(msg->message, reply->message, sizeof error_reply); |
666 | out: | ||
663 | complete(&(resp_type->work)); | 667 | complete(&(resp_type->work)); |
664 | } | 668 | } |
665 | 669 | ||