Skip to contentSkip to conversation

s390/dasd: Fix potential memleak in dasd_eckd_init()

PATCH Applied Qiheng Lin 2 participants 2 messages Dec 8, 2022

Subsystems (2)
lore
Share & tools
lore

Qiheng Lin

author
#0 lore raw

PATCH 1/1 s390/dasd: Fix potential memleak in dasd_eckd_init()

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")
---
 drivers/s390/block/dasd_eckd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/block/dasd_eckd.c +3 -1
index 5d0b9991e91a..b20ce86b97b2 100644
@@ -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) {
Signature · 1 line
2.32.0
maintainer Applied
#1 lore raw

Am 08.12.22 um 14:38 schrieb Qiheng Lin:

Quoted 8 lines

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")

---

Thanks, applied.