dm log: fix dm_io_client leak on error paths
In create_log_context function, dm_io_client_destroy function needs to be called, when memory allocation of disk_header, sync_bits and recovering_bits failed, but dm_io_client_destroy is not called. Cc: stable@kernel.org Signed-off-by: Takahiro Yasui <tyasui@redhat.com> Acked-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
committed by
Alasdair G Kergon
parent
90fa1527bd
commit
c7a2bd19b7
@@ -467,6 +467,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
|
|||||||
lc->disk_header = vmalloc(buf_size);
|
lc->disk_header = vmalloc(buf_size);
|
||||||
if (!lc->disk_header) {
|
if (!lc->disk_header) {
|
||||||
DMWARN("couldn't allocate disk log buffer");
|
DMWARN("couldn't allocate disk log buffer");
|
||||||
|
dm_io_client_destroy(lc->io_req.client);
|
||||||
kfree(lc);
|
kfree(lc);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -482,6 +483,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
|
|||||||
DMWARN("couldn't allocate sync bitset");
|
DMWARN("couldn't allocate sync bitset");
|
||||||
if (!dev)
|
if (!dev)
|
||||||
vfree(lc->clean_bits);
|
vfree(lc->clean_bits);
|
||||||
|
else
|
||||||
|
dm_io_client_destroy(lc->io_req.client);
|
||||||
vfree(lc->disk_header);
|
vfree(lc->disk_header);
|
||||||
kfree(lc);
|
kfree(lc);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -495,6 +498,8 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
|
|||||||
vfree(lc->sync_bits);
|
vfree(lc->sync_bits);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
vfree(lc->clean_bits);
|
vfree(lc->clean_bits);
|
||||||
|
else
|
||||||
|
dm_io_client_destroy(lc->io_req.client);
|
||||||
vfree(lc->disk_header);
|
vfree(lc->disk_header);
|
||||||
kfree(lc);
|
kfree(lc);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Reference in New Issue
Block a user