All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/dasd: Fix potential memleak in dasd_eckd_init()
@ 2022-12-08 13:38 Qiheng Lin
  2022-12-08 15:45 ` Stefan Haberland
  0 siblings, 1 reply; 2+ messages in thread
From: Qiheng Lin @ 2022-12-08 13:38 UTC (permalink / raw
  To: sth, hoeppner, hca, gor, agordeev, borntraeger, svens
  Cc: linux-s390, linux-kernel, linqiheng

`dasd_reserve_req` is allocated before `dasd_vol_info_req`, and it
also needs to be freed before the error returns, just like the other
cases in this function.

Fixes: 9e12e54c7a8f ("s390/dasd: Handle out-of-space constraint")
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/s390/block/dasd_eckd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 5d0b9991e91a..b20ce86b97b2 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -6956,8 +6956,10 @@ dasd_eckd_init(void)
 		return -ENOMEM;
 	dasd_vol_info_req = kmalloc(sizeof(*dasd_vol_info_req),
 				    GFP_KERNEL | GFP_DMA);
-	if (!dasd_vol_info_req)
+	if (!dasd_vol_info_req) {
+		kfree(dasd_reserve_req);
 		return -ENOMEM;
+	}
 	pe_handler_worker = kmalloc(sizeof(*pe_handler_worker),
 				    GFP_KERNEL | GFP_DMA);
 	if (!pe_handler_worker) {
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390/dasd: Fix potential memleak in dasd_eckd_init()
  2022-12-08 13:38 [PATCH] s390/dasd: Fix potential memleak in dasd_eckd_init() Qiheng Lin
@ 2022-12-08 15:45 ` Stefan Haberland
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Haberland @ 2022-12-08 15:45 UTC (permalink / raw
  To: Qiheng Lin, hoeppner, hca, gor, agordeev, borntraeger, svens
  Cc: linux-s390, linux-kernel

Am 08.12.22 um 14:38 schrieb Qiheng Lin:
> `dasd_reserve_req` is allocated before `dasd_vol_info_req`, and it
> also needs to be freed before the error returns, just like the other
> cases in this function.
>
> Fixes: 9e12e54c7a8f ("s390/dasd: Handle out-of-space constraint")
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
>

Thanks, applied.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-08 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-08 13:38 [PATCH] s390/dasd: Fix potential memleak in dasd_eckd_init() Qiheng Lin
2022-12-08 15:45 ` Stefan Haberland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.