libdevmapper prints garbage on shutdown
authorHannes Reinecke <hare@suse.de>
Wed, 30 Apr 2008 09:03:39 +0000 (11:03 +0200)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Wed, 30 Apr 2008 11:25:14 +0000 (13:25 +0200)
commit5ea977617d041d38a2da0efb8b253d72b1e58547
tree732bd9885f8293f0db2458f412742270836bcf79
parent96a0b9f8095f34dfe4b444490b9f776ab08a0b78
libdevmapper prints garbage on shutdown

This patch fixes 2 logging bugs:
  o multipath command prints unexpected log message like
    "libdevmapper: libdm-common.c(303): Created /dev/mapper/<mapname>"
  o multipathd doesn't log messages like "--------shut down------"
    during the exit path

What is the problem:
  o multipath command and multipathd register dm_write_log() using
    dm_log_init() and it can be called from libdevmapper codes like
    dm_lib_release().
  o dm_write_log() references the global "conf" to find the verbosity,
    but it is freed before dm_lib_release() calls dm_write_log().
  o So dm_write_log() reads garbage value like big vervosity.

What does the patch do:
  o multipath command sets NULL to "conf" after freeing it.
    This prevents dm_write_log() from reading garbage data.
  o multipath command and multipathd free "conf" after all logging
    are completed, because the logging functions reference it
    to find the verbosity.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
multipath/main.c
multipathd/main.c