All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] Fix segfault when using vgsplit in stacked environment
Date: Mon, 09 Feb 2009 08:53:45 +0100	[thread overview]
Message-ID: <498FE109.6000103@redhat.com> (raw)

Hi,

this is a small patch for segmentation fault in vgsplit while using 
stacked VGs (rh bz 481793). Segfault is caused by null dereference in 
'pv_uses_vg' function that is called to check if a PV uses VG somewhere 
in its construction. In stacked environment, when the LV/VG from lower 
layer is disabled, the PV constructed above does not exist as well and 
so the device value in PV's structure is set to NULL. We should check 
for this NULL value in 'pv_uses_vg' and return immediately if the 
situation occurs.

Peter


diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 2bc1db7..4ffd7bb 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1105,6 +1105,9 @@ int pv_uses_vg(struct physical_volume *pv,
  	if (!activation())
  		return 0;

+	if (!pv->dev || !pv->dev->dev)
+		return 1;
+
  	if (!dm_is_dm_major(MAJOR(pv->dev->dev)))
  		return 0;



             reply	other threads:[~2009-02-09  7:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09  7:53 Peter Rajnoha [this message]
2009-02-09 12:24 ` [PATCH] Fix segfault when using vgsplit in stacked environment Milan Broz
2009-02-10 18:14 ` Alasdair G Kergon
2009-02-12  9:03   ` Peter Rajnoha
2009-02-16 22:10   ` Petr Rockai

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=498FE109.6000103@redhat.com \
    --to=prajnoha@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.