summary refs log tree commit diff
path: root/fs/ntfs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-11-01 15:49:31 +0000
committerAnton Altaparmakov <aia21@cantab.net>2005-11-01 15:49:31 +0000
commit3aebf25bdcf030f3e4afeb9340486d5b46deb46e (patch)
treed4a0d4e1f0aff3a808846807f3b4d2fd9fa35667 /fs/ntfs
parent1f04c0a24b2f3cfe89c802a24396263623e3512d (diff)
downloadlinux-3aebf25bdcf030f3e4afeb9340486d5b46deb46e.tar.gz
NTFS: Fix a stupid bug causing writes to non-initialized pages to segfault.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/file.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index cf3e6ced2d01..727533891813 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -668,10 +668,10 @@ map_buffer_cached:
 				 * to, we need to read it in before the write,
 				 * i.e. now.
 				 */
-				if (!buffer_uptodate(bh) && ((bh_pos < pos &&
-						bh_end > pos) ||
-						(bh_end > end &&
-						bh_end > end))) {
+				if (!buffer_uptodate(bh) && bh_pos < end &&
+						bh_end > pos &&
+						(bh_pos < pos ||
+						bh_end > end)) {
 					/*
 					 * If the buffer is fully or partially
 					 * within the initialized size, do an
@@ -784,10 +784,11 @@ retry_remap:
 						blocksize_bits);
 				cdelta = 0;
 				/*
-				 * If the number of remaining clusters in the
-				 * @pages is smaller or equal to the number of
-				 * cached clusters, unlock the runlist as the
-				 * map cache will be used from now on.
+				 * If the number of remaining clusters touched
+				 * by the write is smaller or equal to the
+				 * number of cached clusters, unlock the
+				 * runlist as the map cache will be used from
+				 * now on.
 				 */
 				if (likely(vcn + vcn_len >= cend)) {
 					if (rl_write_locked) {