linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e2fsck: skip sorting extents if there are no valid extents
@ 2021-11-17 16:50 Harshad Shirwadkar
  2021-12-03 20:02 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Harshad Shirwadkar @ 2021-11-17 16:50 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, Harshad Shirwadkar

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] e2fsck: skip sorting extents if there are no valid extents
  2021-11-17 16:50 [PATCH] e2fsck: skip sorting extents if there are no valid extents Harshad Shirwadkar
@ 2021-12-03 20:02 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2021-12-03 20:02 UTC (permalink / raw)
  To: Harshad Shirwadkar, linux-ext4; +Cc: Theodore Ts'o

On Wed, 17 Nov 2021 08:50:15 -0800, Harshad Shirwadkar wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] e2fsck: skip sorting extents if there are no valid extents
      commit: 54183fea07676d185b2c169c45a7c1adc7e3e26e

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-03 20:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 16:50 [PATCH] e2fsck: skip sorting extents if there are no valid extents Harshad Shirwadkar
2021-12-03 20:02 ` Theodore Ts'o

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).