[PATCH 13/26] NTFS 2.1.22 - Bug and race fixes and improved error handling.

From: Anton Altaparmakov
Date: Wed Nov 10 2004 - 09:08:44 EST


This is patch 13/26 in the series. It contains the following ChangeSet:

<aia21@xxxxxxxxxx> (04/11/01 1.2026.48.1)
NTFS: Fix stupid bug in fs/ntfs/attrib.c::ntfs_attr_find() that resulted in
a NULL pointer dereference in the error code path when a corrupt
attribute was found.

Thanks to Domen Puncer 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/attrib.c b/fs/ntfs/attrib.c
--- a/fs/ntfs/attrib.c 2004-11-10 13:45:05 +00:00
+++ b/fs/ntfs/attrib.c 2004-11-10 13:45:05 +00:00
@@ -250,19 +250,10 @@
const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx)
{
ATTR_RECORD *a;
- ntfs_volume *vol;
- ntfschar *upcase;
- u32 upcase_len;
+ ntfs_volume *vol = ctx->ntfs_ino->vol;
+ ntfschar *upcase = vol->upcase;
+ u32 upcase_len = vol->upcase_len;

- if (ic == IGNORE_CASE) {
- vol = ctx->ntfs_ino->vol;
- upcase = vol->upcase;
- upcase_len = vol->upcase_len;
- } else {
- vol = NULL;
- upcase = NULL;
- upcase_len = 0;
- }
/*
* Iterate over attributes in mft record starting at @ctx->attr, or the
* attribute following that, if @ctx->is_first is TRUE.
@@ -354,7 +345,7 @@
return -ENOENT;
}
}
- ntfs_error(NULL, "Inode is corrupt. Run chkdsk.");
+ ntfs_error(vol->sb, "Inode is corrupt. Run chkdsk.");
NVolSetErrors(vol);
return -EIO;
}
-
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/