Commit a56bd547 authored by Anton Altaparmakov's avatar Anton Altaparmakov Committed by Richard Russon

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: default avatarAnton Altaparmakov <aia21@cantab.net>
parent ee583c2d
......@@ -66,6 +66,10 @@ ToDo/Notes:
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.
......
......@@ -655,7 +655,6 @@ static int ntfs_external_attr_find(const ATTR_TYPE type,
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 @@ static int ntfs_external_attr_find(const ATTR_TYPE type,
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,6 +742,7 @@ static int ntfs_external_attr_find(const ATTR_TYPE type,
err = -EIO;
}
if (ni != base_ni) {
if (ni)
unmap_extent_mft_record(ni);
ctx->ntfs_ino = base_ni;
ctx->mrec = ctx->base_mrec;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment