提交 84d6ebe6 编写于 作者: A Anton Altaparmakov

NTFS: Fix two nasty runlist merging bugs that had gone unnoticed so far.

      Thanks to Stefano Picerno for the bug report.
Signed-off-by: NAnton Altaparmakov <aia21@cantab.net>
上级 9529d461
...@@ -43,6 +43,8 @@ ToDo/Notes: ...@@ -43,6 +43,8 @@ ToDo/Notes:
- Use ntfs_malloc_nofs_nofail() in the two critical regions in - Use ntfs_malloc_nofs_nofail() in the two critical regions in
fs/ntfs/runlist.c::ntfs_runlists_merge(). This means we no longer fs/ntfs/runlist.c::ntfs_runlists_merge(). This means we no longer
need to panic() if the allocation fails as it now cannot fail. need to panic() if the allocation fails as it now cannot fail.
- Fix two nasty runlist merging bugs that had gone unnoticed so far.
Thanks to Stefano Picerno for the bug report.
2.1.23 - Implement extension of resident files and make writing safe as well as 2.1.23 - Implement extension of resident files and make writing safe as well as
many bug fixes, cleanups, and enhancements... many bug fixes, cleanups, and enhancements...
......
...@@ -542,6 +542,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, ...@@ -542,6 +542,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl,
/* Scan to the end of the source runlist. */ /* Scan to the end of the source runlist. */
for (dend = 0; likely(drl[dend].length); dend++) for (dend = 0; likely(drl[dend].length); dend++)
; ;
dend++;
drl = ntfs_rl_realloc(drl, dend, dend + 1); drl = ntfs_rl_realloc(drl, dend, dend + 1);
if (IS_ERR(drl)) if (IS_ERR(drl))
return drl; return drl;
...@@ -611,8 +612,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, ...@@ -611,8 +612,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl,
((drl[dins].vcn + drl[dins].length) <= /* End of hole */ ((drl[dins].vcn + drl[dins].length) <= /* End of hole */
(srl[send - 1].vcn + srl[send - 1].length))); (srl[send - 1].vcn + srl[send - 1].length)));
/* Or we'll lose an end marker */ /* Or we will lose an end marker. */
if (start && finish && (drl[dins].length == 0)) if (finish && !drl[dins].length)
ss++; ss++;
if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn))
finish = FALSE; finish = FALSE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册