1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-02 04:22:02 +03:00

dev-cache: fix mem corruption on refresh context

When lvm2 command works with clvmd and uses locking in wrong way,
it may 'leak' certain file descriptors in opened (incorrect) state.

dev_cache_exit then destroys memory pool of cached devices, while
_open_devices list in dev-io.c was still referencing them if they
were still opened.

Patch properly calls _close() function to 'self-heal' from this
invalid state, but it will report internal error (so execution
with abort_on_internal_error causes immediate death). On the
normal 'execution', error is only reported, but memory state is
corrected, and linked list is not referencing devices from
released mempool.

For crash see: https://bugzilla.redhat.com/show_bug.cgi?id=1073886
This commit is contained in:
Zdenek Kabelac
2014-03-25 10:53:42 +01:00
parent d29fe919e6
commit 68d13b2517
4 changed files with 31 additions and 9 deletions

View File

@ -1604,7 +1604,8 @@ int refresh_toolcontext(struct cmd_context *cmd)
cmd->filter->destroy(cmd->filter);
cmd->filter = NULL;
}
dev_cache_exit();
if (!dev_cache_exit())
stack;
_destroy_dev_types(cmd);
_destroy_tags(cmd);