lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A52776B.8000203@redhat.com>
Date:	Mon, 06 Jul 2009 17:15:07 -0500
From:	Eric Sandeen <sandeen@...hat.com>
To:	ext4 development <linux-ext4@...r.kernel.org>
Subject: [PATCH] libext2fs: reset handle after inserting new extent

Commit 53422e8a5644e22ea3f6e0efba82a765b72e4308 moved
the new extent insertion in ext2fs_extent_set_bmap prior
to the modification of the original extent, but the
insert function left the handle pointing a the new
extent; this left us modifying the -new- extent not
the original one, and winding up with a corrupt extent
tree something like:

BLOCKS:
(0-1):588791-588792, (0):588791

We need to move back to the previous extent prior
to modification, if we inserted a new one.

Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---

(aside: should there be functions to simply move
the handle around, w/o necessarily populating an
extent structure?)

(aside2: maybe ext2fs_extent_insert should take a flag
saying whether the handle should be moved after the
insertion; moving it around to back where we want to be
seems a bit tedious)

diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index 35b080e..9ea5c30 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -1257,6 +1257,11 @@ again:
 					EXT2_EXTENT_INSERT_AFTER, &newextent);
 			if (retval)
 				goto done;
+			/* Now pointing at new extent; move back to prev */
+			retval = ext2fs_extent_get(handle, EXT2_EXTENT_PREV,
+						   &extent);
+			if (retval)
+				goto done;
 		}
 		extent.e_len--;
 		retval = ext2fs_extent_replace(handle, 0, &extent);

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ