From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Subject: [PATCH] e2fsck: skip sorting extents if there are no valid extents
Date: Wed, 17 Nov 2021 08:50:15 -0800 [thread overview]
Message-ID: <20211117165015.1637593-1-harshads@google.com> (raw)
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
At the end of a fast commit replay, e2fsck tries merging extents in a
inode. This patch fixes a bug in this logic where we were continuing
this action even if there were no extents to merge resulting in
accessing illegal memory.
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
e2fsck/journal.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index fe4e018d..2e867234 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -464,6 +464,9 @@ static void ex_sort_and_merge(struct extent_list *list)
}
}
+ if (list->count == 0)
+ return;
+
/* Now sort by logical offset */
qsort(list->extents, list->count, sizeof(list->extents[0]),
ex_compar);
--
2.34.0.rc1.387.gb447b232ab-goog
next reply other threads:[~2021-11-17 16:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 16:50 Harshad Shirwadkar [this message]
2021-12-03 20:02 ` [PATCH] e2fsck: skip sorting extents if there are no valid extents Theodore Ts'o
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=20211117165015.1637593-1-harshads@google.com \
--to=harshadshirwadkar@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).