Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33c388b8 authored by Wei Yongjun's avatar Wei Yongjun Committed by Martin Schwidefsky
Browse files

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: default avatarWei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent ef4423ce
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -1819,7 +1819,8 @@ int __init ap_module_init(void)
	if (ap_domain_index < -1 || ap_domain_index > max_domain_id) {
	if (ap_domain_index < -1 || ap_domain_index > max_domain_id) {
		pr_warn("%d is not a valid cryptographic domain\n",
		pr_warn("%d is not a valid cryptographic domain\n",
			ap_domain_index);
			ap_domain_index);
		return -EINVAL;
		rc = -EINVAL;
		goto out_free;
	}
	}
	/* In resume callback we need to know if the user had set the domain.
	/* In resume callback we need to know if the user had set the domain.
	 * If so, we can not just reset it.
	 * If so, we can not just reset it.
@@ -1892,6 +1893,7 @@ int __init ap_module_init(void)
	unregister_reset_call(&ap_reset_call);
	unregister_reset_call(&ap_reset_call);
	if (ap_using_interrupts())
	if (ap_using_interrupts())
		unregister_adapter_interrupt(&ap_airq);
		unregister_adapter_interrupt(&ap_airq);
out_free:
	kfree(ap_configuration);
	kfree(ap_configuration);
	return rc;
	return rc;
}
}