aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyj.lk@gmail.com>2016-07-31 05:47:06 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2016-07-31 06:10:41 -0400
commit33c388b81ce4b2f249730014b9b9f103a7578ca2 (patch)
treec524c05300b46b8e7c1d14a277de74886c667399
parentef4423ce70b8a78768a6e854e4d84c082800317d (diff)
s390/zcrypt: fix possible memory leak in ap_module_init()
ap_configuration is malloced in ap_module_init() and should be freed before leaving from the error handling cases, otherwise it may cause memory leak. Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/crypto/ap_bus.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 03e4d6246d87..ed92fb09fc8e 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -1819,7 +1819,8 @@ int __init ap_module_init(void)
1819 if (ap_domain_index < -1 || ap_domain_index > max_domain_id) { 1819 if (ap_domain_index < -1 || ap_domain_index > max_domain_id) {
1820 pr_warn("%d is not a valid cryptographic domain\n", 1820 pr_warn("%d is not a valid cryptographic domain\n",
1821 ap_domain_index); 1821 ap_domain_index);
1822 return -EINVAL; 1822 rc = -EINVAL;
1823 goto out_free;
1823 } 1824 }
1824 /* In resume callback we need to know if the user had set the domain. 1825 /* In resume callback we need to know if the user had set the domain.
1825 * If so, we can not just reset it. 1826 * If so, we can not just reset it.
@@ -1892,6 +1893,7 @@ out:
1892 unregister_reset_call(&ap_reset_call); 1893 unregister_reset_call(&ap_reset_call);
1893 if (ap_using_interrupts()) 1894 if (ap_using_interrupts())
1894 unregister_adapter_interrupt(&ap_airq); 1895 unregister_adapter_interrupt(&ap_airq);
1896out_free:
1895 kfree(ap_configuration); 1897 kfree(ap_configuration);
1896 return rc; 1898 return rc;
1897} 1899}