Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NTFS: Fix a nasty runlist merge bug when merging two holes.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

+6 -2
+2 -1
fs/ntfs/ChangeLog
··· 72 72 runlist. This allows us to find runlist elements with the runlist 73 73 lock already held without having to drop and reacquire it around the 74 74 call. Adapt all callers. 75 - - Change time to u64 time.h::ntfs2utc() as it otherwise generates a 75 + - Change time to u64 in time.h::ntfs2utc() as it otherwise generates a 76 76 warning in the do_div() call on sparc32. Thanks to Meelis Roos for 77 77 the report and analysis of the warning. 78 + - Fix a nasty runlist merge bug when merging two holes. 78 79 79 80 2.1.22 - Many bug and race fixes and error handling improvements. 80 81
+4 -1
fs/ntfs/runlist.c
··· 113 113 BUG_ON(!dst); 114 114 BUG_ON(!src); 115 115 116 - if ((dst->lcn < 0) || (src->lcn < 0)) /* Are we merging holes? */ 116 + if ((dst->lcn < 0) || (src->lcn < 0)) { /* Are we merging holes? */ 117 + if (dst->lcn == LCN_HOLE && src->lcn == LCN_HOLE) 118 + return TRUE; 117 119 return FALSE; 120 + } 118 121 if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */ 119 122 return FALSE; 120 123 if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */