On 2022-11-14 12:08, Wei Yongjun wrote:
From: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
If kzalloc() for 'ap_qci_info_old' failed, 'ap_qci_info' shold be
freed before return. Otherwise it is a memory leak.
Fixes: 283915850a44 ("s390/ap: notify drivers on config changed and
scan complete callbacks")
Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
---
drivers/s390/crypto/ap_bus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/crypto/ap_bus.c
b/drivers/s390/crypto/ap_bus.c
index 59ac98f2bd27..6cbc5e5d2a0e 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -233,8 +233,10 @@ static void __init ap_init_qci_info(void)
if (!ap_qci_info)
return;
ap_qci_info_old = kzalloc(sizeof(*ap_qci_info_old), GFP_KERNEL);
- if (!ap_qci_info_old)
+ if (!ap_qci_info_old) {
+ kfree(ap_qci_info);
return;
+ }
if (ap_fetch_qci_info(ap_qci_info) != 0) {
kfree(ap_qci_info);
kfree(ap_qci_info_old);
Thanks, I picked this and pushed it into the s390 subsystem repo.
Will be visible in the Linus' tree with the next merge window.