Skip to content

Commit 9ac74f0

Browse files
Wei YongjunAlexander Gordeev
authored andcommitted
s390/ap: fix memory leak in ap_init_qci_info()
If kzalloc() for 'ap_qci_info_old' failed, 'ap_qci_info' shold be freed before return. Otherwise it is a memory leak. Link: https://lore.kernel.org/r/[email protected] Fixes: 2839158 ("s390/ap: notify drivers on config changed and scan complete callbacks") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Harald Freudenberger <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent e3c1102 commit 9ac74f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/s390/crypto/ap_bus.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,11 @@ static void __init ap_init_qci_info(void)
233233
if (!ap_qci_info)
234234
return;
235235
ap_qci_info_old = kzalloc(sizeof(*ap_qci_info_old), GFP_KERNEL);
236-
if (!ap_qci_info_old)
236+
if (!ap_qci_info_old) {
237+
kfree(ap_qci_info);
238+
ap_qci_info = NULL;
237239
return;
240+
}
238241
if (ap_fetch_qci_info(ap_qci_info) != 0) {
239242
kfree(ap_qci_info);
240243
kfree(ap_qci_info_old);

0 commit comments

Comments
 (0)