All of lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] Fix log allocation segfault
Date: Sun, 31 May 2009 22:45:56 +0200	[thread overview]
Message-ID: <4A22EC84.7010209@redhat.com> (raw)

Fix log allocation segfault.

If there is no free area for log, code should break the loop.
(Otherwise it uses uninitializes areas later.)

Easily reproducible using lvconvert --repair
 - kill device with log
 - run lvconvert --repair vg/lv (with no PV usable for log)

(patch just reintroduces part of previous code)

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 lib/metadata/lv_manip.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 79407ae..3e64f48 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1124,6 +1124,10 @@ static int _find_parallel_space(struct alloc_handle *ah, alloc_policy_t alloc,
 		if ((contiguous || cling) && (preferred_count < ix_offset))
 			break;
 
+		if (ix + ix_offset < ah->area_count +
+			((ah->log_count && !ah->log_area.len) ? ah->log_count : 0))
+			break;
+
 		/* sort the areas so we allocate from the biggest */
 		if (ix > 1)
 			qsort(areas + ix_offset, ix, sizeof(*areas),





                 reply	other threads:[~2009-05-31 20:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A22EC84.7010209@redhat.com \
    --to=mbroz@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.