diff options
author | Felix Beck <felix.beck@de.ibm.com> | 2009-12-07 06:51:54 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2009-12-07 06:51:35 -0500 |
commit | 468ffddf19c1417947cac931c240b0d600e4b5bf (patch) | |
tree | 94510571f3dcc94b6f61efebc077bfb93047b77d /drivers/s390 | |
parent | f4ac1d0255748fe0f8e128a26b1c29490cae5c08 (diff) |
[S390] zcrypt: initialize ap_messages for cex3 exploitation
AP messages need to be initialized, before they will be used. Values
will be zeroized. This will be needed later when introducing support
for the special commands.
Signed-off-by: Felix Beck <felix.beck@de.ibm.com>
Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/crypto/ap_bus.h | 11 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_cex2a.c | 2 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcica.c | 2 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcicc.c | 2 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_pcixcc.c | 5 |
5 files changed, 22 insertions, 0 deletions
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h index a35362241805..fcf2497556dd 100644 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h | |||
@@ -167,6 +167,17 @@ struct ap_message { | |||
167 | .dev_type=(dt), \ | 167 | .dev_type=(dt), \ |
168 | .match_flags=AP_DEVICE_ID_MATCH_DEVICE_TYPE, | 168 | .match_flags=AP_DEVICE_ID_MATCH_DEVICE_TYPE, |
169 | 169 | ||
170 | /** | ||
171 | * ap_init_message() - Initialize ap_message. | ||
172 | * Initialize a message before using. Otherwise this might result in | ||
173 | * unexpected behaviour. | ||
174 | */ | ||
175 | static inline void ap_init_message(struct ap_message *ap_msg) | ||
176 | { | ||
177 | ap_msg->psmid = 0; | ||
178 | ap_msg->length = 0; | ||
179 | } | ||
180 | |||
170 | /* | 181 | /* |
171 | * Note: don't use ap_send/ap_recv after using ap_queue_message | 182 | * Note: don't use ap_send/ap_recv after using ap_queue_message |
172 | * for the first time. Otherwise the ap message queue will get | 183 | * for the first time. Otherwise the ap message queue will get |
diff --git a/drivers/s390/crypto/zcrypt_cex2a.c b/drivers/s390/crypto/zcrypt_cex2a.c index 326ea08f67c9..ad61a6a59374 100644 --- a/drivers/s390/crypto/zcrypt_cex2a.c +++ b/drivers/s390/crypto/zcrypt_cex2a.c | |||
@@ -298,6 +298,7 @@ static long zcrypt_cex2a_modexpo(struct zcrypt_device *zdev, | |||
298 | struct completion work; | 298 | struct completion work; |
299 | int rc; | 299 | int rc; |
300 | 300 | ||
301 | ap_init_message(&ap_msg); | ||
301 | ap_msg.message = kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); | 302 | ap_msg.message = kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); |
302 | if (!ap_msg.message) | 303 | if (!ap_msg.message) |
303 | return -ENOMEM; | 304 | return -ENOMEM; |
@@ -335,6 +336,7 @@ static long zcrypt_cex2a_modexpo_crt(struct zcrypt_device *zdev, | |||
335 | struct completion work; | 336 | struct completion work; |
336 | int rc; | 337 | int rc; |
337 | 338 | ||
339 | ap_init_message(&ap_msg); | ||
338 | ap_msg.message = kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); | 340 | ap_msg.message = kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); |
339 | if (!ap_msg.message) | 341 | if (!ap_msg.message) |
340 | return -ENOMEM; | 342 | return -ENOMEM; |
diff --git a/drivers/s390/crypto/zcrypt_pcica.c b/drivers/s390/crypto/zcrypt_pcica.c index 17ba81b58c78..e78df3671caf 100644 --- a/drivers/s390/crypto/zcrypt_pcica.c +++ b/drivers/s390/crypto/zcrypt_pcica.c | |||
@@ -281,6 +281,7 @@ static long zcrypt_pcica_modexpo(struct zcrypt_device *zdev, | |||
281 | struct completion work; | 281 | struct completion work; |
282 | int rc; | 282 | int rc; |
283 | 283 | ||
284 | ap_init_message(&ap_msg); | ||
284 | ap_msg.message = kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); | 285 | ap_msg.message = kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); |
285 | if (!ap_msg.message) | 286 | if (!ap_msg.message) |
286 | return -ENOMEM; | 287 | return -ENOMEM; |
@@ -318,6 +319,7 @@ static long zcrypt_pcica_modexpo_crt(struct zcrypt_device *zdev, | |||
318 | struct completion work; | 319 | struct completion work; |
319 | int rc; | 320 | int rc; |
320 | 321 | ||
322 | ap_init_message(&ap_msg); | ||
321 | ap_msg.message = kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); | 323 | ap_msg.message = kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); |
322 | if (!ap_msg.message) | 324 | if (!ap_msg.message) |
323 | return -ENOMEM; | 325 | return -ENOMEM; |
diff --git a/drivers/s390/crypto/zcrypt_pcicc.c b/drivers/s390/crypto/zcrypt_pcicc.c index f4b0c4795434..a23726a0735c 100644 --- a/drivers/s390/crypto/zcrypt_pcicc.c +++ b/drivers/s390/crypto/zcrypt_pcicc.c | |||
@@ -483,6 +483,7 @@ static long zcrypt_pcicc_modexpo(struct zcrypt_device *zdev, | |||
483 | struct completion work; | 483 | struct completion work; |
484 | int rc; | 484 | int rc; |
485 | 485 | ||
486 | ap_init_message(&ap_msg); | ||
486 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); | 487 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); |
487 | if (!ap_msg.message) | 488 | if (!ap_msg.message) |
488 | return -ENOMEM; | 489 | return -ENOMEM; |
@@ -521,6 +522,7 @@ static long zcrypt_pcicc_modexpo_crt(struct zcrypt_device *zdev, | |||
521 | struct completion work; | 522 | struct completion work; |
522 | int rc; | 523 | int rc; |
523 | 524 | ||
525 | ap_init_message(&ap_msg); | ||
524 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); | 526 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); |
525 | if (!ap_msg.message) | 527 | if (!ap_msg.message) |
526 | return -ENOMEM; | 528 | return -ENOMEM; |
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c index 5677b40e4ac0..11ca6dc99b23 100644 --- a/drivers/s390/crypto/zcrypt_pcixcc.c +++ b/drivers/s390/crypto/zcrypt_pcixcc.c | |||
@@ -688,6 +688,7 @@ static long zcrypt_pcixcc_modexpo(struct zcrypt_device *zdev, | |||
688 | }; | 688 | }; |
689 | int rc; | 689 | int rc; |
690 | 690 | ||
691 | ap_init_message(&ap_msg); | ||
691 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); | 692 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); |
692 | if (!ap_msg.message) | 693 | if (!ap_msg.message) |
693 | return -ENOMEM; | 694 | return -ENOMEM; |
@@ -727,6 +728,7 @@ static long zcrypt_pcixcc_modexpo_crt(struct zcrypt_device *zdev, | |||
727 | }; | 728 | }; |
728 | int rc; | 729 | int rc; |
729 | 730 | ||
731 | ap_init_message(&ap_msg); | ||
730 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); | 732 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); |
731 | if (!ap_msg.message) | 733 | if (!ap_msg.message) |
732 | return -ENOMEM; | 734 | return -ENOMEM; |
@@ -766,6 +768,7 @@ static long zcrypt_pcixcc_send_cprb(struct zcrypt_device *zdev, | |||
766 | }; | 768 | }; |
767 | int rc; | 769 | int rc; |
768 | 770 | ||
771 | ap_init_message(&ap_msg); | ||
769 | ap_msg.message = kmalloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE, GFP_KERNEL); | 772 | ap_msg.message = kmalloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE, GFP_KERNEL); |
770 | if (!ap_msg.message) | 773 | if (!ap_msg.message) |
771 | return -ENOMEM; | 774 | return -ENOMEM; |
@@ -805,6 +808,7 @@ static long zcrypt_pcixcc_rng(struct zcrypt_device *zdev, | |||
805 | }; | 808 | }; |
806 | int rc; | 809 | int rc; |
807 | 810 | ||
811 | ap_init_message(&ap_msg); | ||
808 | ap_msg.message = kmalloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE, GFP_KERNEL); | 812 | ap_msg.message = kmalloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE, GFP_KERNEL); |
809 | if (!ap_msg.message) | 813 | if (!ap_msg.message) |
810 | return -ENOMEM; | 814 | return -ENOMEM; |
@@ -972,6 +976,7 @@ static int zcrypt_pcixcc_rng_supported(struct ap_device *ap_dev) | |||
972 | } __attribute__((packed)) *reply; | 976 | } __attribute__((packed)) *reply; |
973 | int rc, i; | 977 | int rc, i; |
974 | 978 | ||
979 | ap_init_message(&ap_msg); | ||
975 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); | 980 | ap_msg.message = (void *) get_zeroed_page(GFP_KERNEL); |
976 | if (!ap_msg.message) | 981 | if (!ap_msg.message) |
977 | return -ENOMEM; | 982 | return -ENOMEM; |