Commit 460e9bed authored by Qiheng Lin's avatar Qiheng Lin Committed by Jens Axboe

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: 9e12e54c ("s390/dasd: Handle out-of-space constraint")
Signed-off-by: default avatarQiheng Lin <linqiheng@huawei.com>
Link: https://lore.kernel.org/r/20221208133809.16796-1-linqiheng@huawei.comSigned-off-by: default avatarStefan Haberland <sth@linux.ibm.com>
Link: https://lore.kernel.org/r/20230210000253.1644903-3-sth@linux.ibm.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b87c52e4
...@@ -6954,8 +6954,10 @@ dasd_eckd_init(void) ...@@ -6954,8 +6954,10 @@ dasd_eckd_init(void)
return -ENOMEM; return -ENOMEM;
dasd_vol_info_req = kmalloc(sizeof(*dasd_vol_info_req), dasd_vol_info_req = kmalloc(sizeof(*dasd_vol_info_req),
GFP_KERNEL | GFP_DMA); GFP_KERNEL | GFP_DMA);
if (!dasd_vol_info_req) if (!dasd_vol_info_req) {
kfree(dasd_reserve_req);
return -ENOMEM; return -ENOMEM;
}
pe_handler_worker = kmalloc(sizeof(*pe_handler_worker), pe_handler_worker = kmalloc(sizeof(*pe_handler_worker),
GFP_KERNEL | GFP_DMA); GFP_KERNEL | GFP_DMA);
if (!pe_handler_worker) { if (!pe_handler_worker) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment