From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_metadump: ignore attr leaf with 0 entries
Date: Thu, 2 Feb 2017 09:54:56 -0600 [thread overview]
Message-ID: <7481b076-dbc6-ddaa-4e3f-9a1bc2b94e26@redhat.com> (raw)
Another in the ongoing saga of attribute leaves with zero
entries; in this case, if we try to metadump an inode with
a zero-entries attribute leaf, the zeroing code will go off
the rails and segfault at:
memset(&entries[nentries], 0,
first_name - (char *)&entries[nentries]);
because first_name is null, and we try to memset a large
(negative) number.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/db/metadump.c b/db/metadump.c
index 38519f1..66952f6 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1654,7 +1654,8 @@ process_attr_block(
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &hdr, leaf);
nentries = hdr.count;
- if (nentries * sizeof(xfs_attr_leaf_entry_t) +
+ if (nentries == 0 ||
+ nentries * sizeof(xfs_attr_leaf_entry_t) +
xfs_attr3_leaf_hdr_size(leaf) >
XFS_ATTR3_RMT_BUF_SPACE(mp, bs)) {
if (show_warnings)
next reply other threads:[~2017-02-02 15:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-02 15:54 Eric Sandeen [this message]
2017-02-16 3:31 ` [PATCH] xfs_metadump: ignore attr leaf with 0 entries Darrick J. Wong
2017-02-16 3:54 ` Eric Sandeen
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=7481b076-dbc6-ddaa-4e3f-9a1bc2b94e26@redhat.com \
--to=sandeen@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/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 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).