All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - writecache: fix lv_on_pmem
Date: Wed,  2 Jun 2021 16:14:03 +0000 (GMT)	[thread overview]
Message-ID: <20210602161403.2DBA1396EC42@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=247f69f9aafe731ef85268da1e6ce817295b265d
Commit:        247f69f9aafe731ef85268da1e6ce817295b265d
Parent:        b725b5ea6ecfeef428fd7ffcd6855a38378d761b
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Wed Jun 2 10:51:12 2021 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Wed Jun 2 10:51:12 2021 -0500

writecache: fix lv_on_pmem

dev_is_pmem on pv->dev requires a pv segment or it could segfault.
---
 lib/metadata/metadata.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 110cbaed4..0b284435b 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4412,6 +4412,9 @@ int lv_on_pmem(struct logical_volume *lv)
 
 	dm_list_iterate_items(seg, &lv->segments) {
 		for (s = 0; s < seg->area_count; s++) {
+			if (seg_type(seg, s) != AREA_PV)
+				continue;
+
 			pv = seg_pv(seg, s);
 
 			if (dev_is_pmem(lv->vg->cmd->dev_types, pv->dev)) {



                 reply	other threads:[~2021-06-02 16:14 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=20210602161403.2DBA1396EC42@sourceware.org \
    --to=teigland@sourceware.org \
    --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.