mirror of
https://github.com/torvalds/linux.git
synced 2025-01-01 15:51:46 +00:00
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/20221114110830.542246-1-weiyongjun@huaweicloud.com
Fixes: 283915850a
("s390/ap: notify drivers on config changed and scan complete callbacks")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
e3c11025bc
commit
9ac74f0666
@ -233,8 +233,11 @@ 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);
|
||||
ap_qci_info = NULL;
|
||||
return;
|
||||
}
|
||||
if (ap_fetch_qci_info(ap_qci_info) != 0) {
|
||||
kfree(ap_qci_info);
|
||||
kfree(ap_qci_info_old);
|
||||
|
Loading…
Reference in New Issue
Block a user