Bug 220563 - _raw_read_mda_header does not free struct mda_header *mdah in error paths
_raw_read_mda_header does not free struct mda_header *mdah in error paths
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: lvm2 (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Dave Wysochanski
Corey Marthaler
Depends On:
  Show dependency treegraph
Reported: 2006-12-21 21:36 EST by Dave Wysochanski
Modified: 2007-11-16 20:14 EST (History)
6 users (show)

See Also:
Fixed In Version: RHBA-2007-0287
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-05-07 20:14:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2007:0287 normal SHIPPED_LIVE lvm2 bug fix and enhancement update 2007-04-28 15:01:34 EDT

  None (edit)
Description Dave Wysochanski 2006-12-21 21:36:37 EST

Should be calling dm_pool_free in error paths that return NULL below.

static struct mda_header *_raw_read_mda_header(const struct format_type *fmt,
					       struct device_area *dev_area)
	struct mda_header *mdah;

	if (!(mdah = dm_pool_alloc(fmt->cmd->mem, MDA_HEADER_SIZE))) {
		log_error("struct mda_header allocation failed");
		return NULL;

	if (!dev_read(dev_area->dev, dev_area->start, MDA_HEADER_SIZE, mdah)) {
		dm_pool_free(fmt->cmd->mem, mdah);
		return NULL;

	if (mdah->checksum_xl != xlate32(calc_crc(INITIAL_CRC, mdah->magic,
						  sizeof(mdah->checksum_xl)))) {
		log_error("Incorrect metadata area header checksum");
		return NULL;


	if (strncmp((char *)mdah->magic, FMTT_MAGIC, sizeof(mdah->magic))) {
		log_error("Wrong magic number in metadata area header");
		return NULL;

	if (mdah->version != FMTT_VERSION) {
		log_error("Incompatible metadata area header version: %d",
		return NULL;

	if (mdah->start != dev_area->start) {
		log_error("Incorrect start sector in metadata area header: %"
			  PRIu64, mdah->start);
		return NULL;

	return mdah;
Comment 1 Dave Wysochanski 2006-12-21 21:40:26 EST
This is actually upstream cvs - haven't checked rhel4 code actually but probably
a bug there as well.
Comment 2 Dave Wysochanski 2007-01-08 17:09:33 EST
Posted patch to lvm-devel
Comment 3 Dave Wysochanski 2007-01-17 16:37:40 EST
In Version 2.02.18 - 11th January 2007 and in brew
Comment 4 Dave Wysochanski 2007-01-22 12:31:46 EST
Verified this code is in brew, lvm2-2.02.19-1.el4.src.rpm
Comment 8 Red Hat Bugzilla 2007-05-07 20:14:21 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.