Skip to content

Commit 460e9be

Browse files
ATRiiXaxboe
authored andcommitted
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: 9e12e54 ("s390/dasd: Handle out-of-space constraint") Signed-off-by: Qiheng Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stefan Haberland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b87c52e commit 460e9be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/s390/block/dasd_eckd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6954,8 +6954,10 @@ dasd_eckd_init(void)
69546954
return -ENOMEM;
69556955
dasd_vol_info_req = kmalloc(sizeof(*dasd_vol_info_req),
69566956
GFP_KERNEL | GFP_DMA);
6957-
if (!dasd_vol_info_req)
6957+
if (!dasd_vol_info_req) {
6958+
kfree(dasd_reserve_req);
69586959
return -ENOMEM;
6960+
}
69596961
pe_handler_worker = kmalloc(sizeof(*pe_handler_worker),
69606962
GFP_KERNEL | GFP_DMA);
69616963
if (!pe_handler_worker) {

0 commit comments

Comments
 (0)