From: Harald Freudenberger <freude@linux.ibm.com>
To: Wei Yongjun <weiyongjun@huaweicloud.com>
Cc: Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Tony Krowiak <akrowiak@linux.ibm.com>,
Wei Yongjun <weiyongjun1@huawei.com>,
linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/ap: fix memory leak in ap_init_qci_info()
Date: Tue, 15 Nov 2022 10:45:55 +0100 [thread overview]
Message-ID: <5a73bccdfd2a3210dba0495a77a9ec1e@linux.ibm.com> (raw)
In-Reply-To: <20221114110830.542246-1-weiyongjun@huaweicloud.com>
On 2022-11-14 12:08, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> 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@huawei.com>
> ---
> 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.
prev parent reply other threads:[~2022-11-15 9:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 11:08 [PATCH] s390/ap: fix memory leak in ap_init_qci_info() Wei Yongjun
2022-11-15 9:45 ` Harald Freudenberger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a73bccdfd2a3210dba0495a77a9ec1e@linux.ibm.com \
--to=freude@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=svens@linux.ibm.com \
--cc=weiyongjun1@huawei.com \
--cc=weiyongjun@huaweicloud.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox