diff -urNp linux-2.4.20-ntfs-2.1.2a/Documentation/filesystems/ntfs.txt linux-2.4.20-ntfs-2.1.3a/Documentation/filesystems/ntfs.txt --- linux-2.4.20-ntfs-2.1.2a/Documentation/filesystems/ntfs.txt Tue Apr 22 18:23:09 2003 +++ linux-2.4.20-ntfs-2.1.3a/Documentation/filesystems/ntfs.txt Tue Apr 22 18:16:19 2003 @@ -247,6 +247,9 @@ ChangeLog Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog. +2.1.3a: + - Major bug fixes for reading files and volumes in corner cases which + were being hit by Windows 2k/XP users. 2.1.2a: - Major bug fixes aleviating the hangs in statfs experienced by some users. diff -urNp linux-2.4.20-ntfs-2.1.2a/fs/ntfs/ChangeLog linux-2.4.20-ntfs-2.1.3a/fs/ntfs/ChangeLog --- linux-2.4.20-ntfs-2.1.2a/fs/ntfs/ChangeLog Tue Apr 22 18:23:09 2003 +++ linux-2.4.20-ntfs-2.1.3a/fs/ntfs/ChangeLog Tue Apr 22 18:16:20 2003 @@ -20,6 +20,14 @@ ToDo: sufficient for synchronisation here. We then just need to make sure ntfs_readpage/writepage/truncate interoperate properly with us. +2.1.3a - Important bug fixes in corner cases. + + - super.c::parse_ntfs_boot_sector(): Correct the check for 64-bit + clusters. (Philipp Thomas ) + 2.1.2a - Important bug fixes aleviating the hangs in statfs. - Fix buggy free cluster and free inode determination logic. diff -urNp linux-2.4.20-ntfs-2.1.2a/fs/ntfs/Makefile linux-2.4.20-ntfs-2.1.3a/fs/ntfs/Makefile --- linux-2.4.20-ntfs-2.1.2a/fs/ntfs/Makefile Tue Apr 22 18:23:09 2003 +++ linux-2.4.20-ntfs-2.1.3a/fs/ntfs/Makefile Tue Apr 22 18:16:20 2003 @@ -7,7 +7,7 @@ obj-y := aops.o attrib.o compress.o de obj-m := $(O_TARGET) -EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.2a\" +EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.3a\" ifeq ($(CONFIG_NTFS_DEBUG),y) EXTRA_CFLAGS += -DDEBUG diff -urNp linux-2.4.20-ntfs-2.1.2a/fs/ntfs/attrib.c linux-2.4.20-ntfs-2.1.3a/fs/ntfs/attrib.c --- linux-2.4.20-ntfs-2.1.2a/fs/ntfs/attrib.c Tue Apr 22 18:23:09 2003 +++ linux-2.4.20-ntfs-2.1.3a/fs/ntfs/attrib.c Tue Apr 22 18:16:20 2003 @@ -1237,11 +1237,9 @@ int load_attribute_list(ntfs_volume *vol unsigned char block_size_bits = sb->s_blocksize_bits; ntfs_debug("Entering."); -#ifdef DEBUG if (!vol || !run_list || !al || size <= 0 || initialized_size < 0 || initialized_size > size) return -EINVAL; -#endif if (!initialized_size) { memset(al, 0, size); return 0; @@ -1272,8 +1270,8 @@ int load_attribute_list(ntfs_volume *vol "read attribute list."); goto err_out; } - if (al + block_size > al_end) - goto do_partial; + if (al + block_size >= al_end) + goto do_final; memcpy(al, bh->b_data, block_size); brelse(bh); al += block_size; @@ -1287,7 +1285,7 @@ initialize: done: up_read(&run_list->lock); return err; -do_partial: +do_final: if (al < al_end) { /* Partial block. */ memcpy(al, bh->b_data, al_end - al); diff -urNp linux-2.4.20-ntfs-2.1.2a/fs/ntfs/compress.c linux-2.4.20-ntfs-2.1.3a/fs/ntfs/compress.c --- linux-2.4.20-ntfs-2.1.2a/fs/ntfs/compress.c Tue Apr 22 18:23:09 2003 +++ linux-2.4.20-ntfs-2.1.3a/fs/ntfs/compress.c Tue Apr 22 18:16:20 2003 @@ -198,7 +198,7 @@ do_next_sb: cb - cb_start); /* Have we reached the end of the compression block? */ - if (cb == cb_end || !le16_to_cpup(cb)) { + if (cb == cb_end || !le16_to_cpup((u16*)cb)) { int i; ntfs_debug("Completed. Returning success (0)."); @@ -248,7 +248,8 @@ return_error: /* Setup the current sub-block source pointers and validate range. */ cb_sb_start = cb; - cb_sb_end = cb_sb_start + (le16_to_cpup(cb) & NTFS_SB_SIZE_MASK) + 3; + cb_sb_end = cb_sb_start + (le16_to_cpup((u16*)cb) & NTFS_SB_SIZE_MASK) + + 3; if (cb_sb_end > cb_end) goto return_overflow; @@ -269,7 +270,7 @@ return_error: dp_addr = (u8*)page_address(dp) + do_sb_start; /* Now, we are ready to process the current sub-block (sb). */ - if (!(le16_to_cpup(cb) & NTFS_SB_IS_COMPRESSED)) { + if (!(le16_to_cpup((u16*)cb) & NTFS_SB_IS_COMPRESSED)) { ntfs_debug("Found uncompressed sub-block."); /* This sb is not compressed, just copy it into destination. */ @@ -374,7 +375,7 @@ do_next_tag: lg++; /* Get the phrase token into i. */ - pt = le16_to_cpup(cb); + pt = le16_to_cpup((u16*)cb); /* * Calculate starting position of the byte sequence in diff -urNp linux-2.4.20-ntfs-2.1.2a/fs/ntfs/super.c linux-2.4.20-ntfs-2.1.3a/fs/ntfs/super.c --- linux-2.4.20-ntfs-2.1.2a/fs/ntfs/super.c Tue Apr 22 18:23:09 2003 +++ linux-2.4.20-ntfs-2.1.3a/fs/ntfs/super.c Tue Apr 22 18:16:20 2003 @@ -619,9 +619,8 @@ static BOOL parse_ntfs_boot_sector(ntfs_ * the same as it is much faster on 32-bit CPUs. */ ll = sle64_to_cpu(b->number_of_sectors) >> sectors_per_cluster_bits; - if ((u64)ll >= 1ULL << (sizeof(unsigned long) * 8)) { - ntfs_error(vol->sb, "Cannot handle %i-bit clusters. Sorry.", - sizeof(unsigned long) * 4); + if ((u64)ll >= 1ULL << 32) { + ntfs_error(vol->sb, "Cannot handle 64-bit clusters. Sorry."); return FALSE; } vol->nr_clusters = ll;