archive mirror
 help / color / mirror / Atom feed
From: Konstantin Kharlamov <>
Subject: [linux-lvm] Frequent crashes when accessing dev_name(dev) on an empty list
Date: Mon, 21 Feb 2022 16:45:51 +0300	[thread overview]
Message-ID: <> (raw)

Hello! We encountered quite a few of sporadic crashes, which upon inspection turned out to be caused by dev->aliases list being empty.

One example of a fix (not tested):

--- a/lib/label/hints.c
+++ b/lib/label/hints.c
@@ -471,7 +471,8 @@ int validate_hints(struct cmd_context *cmd, struct dm_list
    471         if (!(iter = dev_iter_create(NULL, 0)))
    472                 return 0;
    473         while ((dev = dev_iter_get(cmd, iter))) {
474    -                if (!(hint = _find_hint_name(hints, dev_name(dev))))
    474+                if (dm_list_empty(dev->aliases) ||
    475+                    !(hint = _find_hint_name(hints, dev_name(dev))))
475 476                         continue;
476 477
477 478                 /* The cmd hasn't needed this hint's dev so it's not
been scanned. */

So, what happened was that dev_name(dev) was extracting a `dev->aliases` element
, however `dev->aliases` was empty, thus the extracted element was a junk.

Although we encountered these crashes on an older 2.03.07 version, however the
patch applies to latest master as well, thus the bugs are still relevant, which
is odd. This makes me wondering, is this a known problem, could I possibly
overlooked something, for example that dev->aliases should never be empty, and
thus the fix just works around another problem? Any thoughts?

linux-lvm mailing list
read the LVM HOW-TO at

             reply	other threads:[~2022-02-21 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 13:45 Konstantin Kharlamov [this message]
2022-02-21 16:49 ` [linux-lvm] Frequent crashes when accessing dev_name(dev) on an empty list David Teigland
2022-02-21 17:35   ` Konstantin Kharlamov
2022-04-01 14:48 ` Konstantin Kharlamov

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:

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

  git send-email \ \ \ \

* 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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).