aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-09-08 11:46:55 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-09-08 11:46:55 -0400
commit84d6ebe63f50b6efd8be252b58a207132157c60f (patch)
tree5e78199877a800c92528c2ed0272c863d2c9733c
parent9529d461d0992959026264b8fc002ac01d226708 (diff)
NTFS: Fix two nasty runlist merging bugs that had gone unnoticed so far.
Thanks to Stefano Picerno for the bug report. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
-rw-r--r--fs/ntfs/ChangeLog2
-rw-r--r--fs/ntfs/runlist.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index c5bbedff5ae5..4bc8f91c5fc0 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -43,6 +43,8 @@ ToDo/Notes:
43 - Use ntfs_malloc_nofs_nofail() in the two critical regions in 43 - Use ntfs_malloc_nofs_nofail() in the two critical regions in
44 fs/ntfs/runlist.c::ntfs_runlists_merge(). This means we no longer 44 fs/ntfs/runlist.c::ntfs_runlists_merge(). This means we no longer
45 need to panic() if the allocation fails as it now cannot fail. 45 need to panic() if the allocation fails as it now cannot fail.
46 - Fix two nasty runlist merging bugs that had gone unnoticed so far.
47 Thanks to Stefano Picerno for the bug report.
46 48
472.1.23 - Implement extension of resident files and make writing safe as well as 492.1.23 - Implement extension of resident files and make writing safe as well as
48 many bug fixes, cleanups, and enhancements... 50 many bug fixes, cleanups, and enhancements...
diff --git a/fs/ntfs/runlist.c b/fs/ntfs/runlist.c
index 3bb4a57d1fa9..d26a1be530c5 100644
--- a/fs/ntfs/runlist.c
+++ b/fs/ntfs/runlist.c
@@ -542,6 +542,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl,
542 /* Scan to the end of the source runlist. */ 542 /* Scan to the end of the source runlist. */
543 for (dend = 0; likely(drl[dend].length); dend++) 543 for (dend = 0; likely(drl[dend].length); dend++)
544 ; 544 ;
545 dend++;
545 drl = ntfs_rl_realloc(drl, dend, dend + 1); 546 drl = ntfs_rl_realloc(drl, dend, dend + 1);
546 if (IS_ERR(drl)) 547 if (IS_ERR(drl))
547 return drl; 548 return drl;
@@ -611,8 +612,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl,
611 ((drl[dins].vcn + drl[dins].length) <= /* End of hole */ 612 ((drl[dins].vcn + drl[dins].length) <= /* End of hole */
612 (srl[send - 1].vcn + srl[send - 1].length))); 613 (srl[send - 1].vcn + srl[send - 1].length)));
613 614
614 /* Or we'll lose an end marker */ 615 /* Or we will lose an end marker. */
615 if (start && finish && (drl[dins].length == 0)) 616 if (finish && !drl[dins].length)
616 ss++; 617 ss++;
617 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) 618 if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn))
618 finish = FALSE; 619 finish = FALSE;