[PATCH 17/26] NTFS 2.1.22 - Bug and race fixes and improved error handling.
From: Anton Altaparmakov
Date: Wed Nov 10 2004 - 10:05:56 EST
This is patch 17/26 in the series. It contains the following ChangeSet:
<aia21@xxxxxxxxxx> (04/11/04 1.2026.1.52)
NTFS: Fix stupid bug in fs/ntfs/attrib.c::ntfs_external_attr_find() in the
error handling code path that resulted in a BUG() due to trying to
unmap an extent mft record when the mapping of it had failed and it
thus was not mapped. (Thanks to Ken MacFerrin for the bug report.)
Signed-off-by: Anton Altaparmakov <aia21@xxxxxxxxxx>
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/
===================================================================
diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog 2004-11-10 13:45:20 +00:00
+++ b/fs/ntfs/ChangeLog 2004-11-10 13:45:20 +00:00
@@ -66,6 +66,10 @@
buffers belonging to the ntfs record dirty. This causes the buffers
to become busy and hence they are safe from removal until the page
has been written out.
+ - Fix stupid bug in fs/ntfs/attrib.c::ntfs_external_attr_find() in the
+ error handling code path that resulted in a BUG() due to trying to
+ unmap an extent mft record when the mapping of it had failed and it
+ thus was not mapped. (Thanks to Ken MacFerrin for the bug report.)
2.1.21 - Fix some races and bugs, rewrite mft write code, add mft allocator.
diff -Nru a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
--- a/fs/ntfs/attrib.c 2004-11-10 13:45:20 +00:00
+++ b/fs/ntfs/attrib.c 2004-11-10 13:45:20 +00:00
@@ -655,7 +655,6 @@
ctx->mrec = map_extent_mft_record(base_ni,
le64_to_cpu(
al_entry->mft_reference), &ni);
- ctx->ntfs_ino = ni;
if (IS_ERR(ctx->mrec)) {
ntfs_error(vol->sb, "Failed to map "
"extent mft record "
@@ -667,8 +666,11 @@
err = PTR_ERR(ctx->mrec);
if (err == -ENOENT)
err = -EIO;
+ /* Cause @ctx to be sanitized below. */
+ ni = NULL;
break;
}
+ ctx->ntfs_ino = ni;
}
ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec +
le16_to_cpu(ctx->mrec->attrs_offset));
@@ -740,7 +742,8 @@
err = -EIO;
}
if (ni != base_ni) {
- unmap_extent_mft_record(ni);
+ if (ni)
+ unmap_extent_mft_record(ni);
ctx->ntfs_ino = base_ni;
ctx->mrec = ctx->base_mrec;
ctx->attr = ctx->base_attr;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/