diff options
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/file.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index dbbac5593106..621de369e6f8 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2129,28 +2129,13 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb, | |||
2129 | struct address_space *mapping = file->f_mapping; | 2129 | struct address_space *mapping = file->f_mapping; |
2130 | struct inode *inode = mapping->host; | 2130 | struct inode *inode = mapping->host; |
2131 | loff_t pos; | 2131 | loff_t pos; |
2132 | unsigned long seg; | ||
2133 | size_t count; /* after file limit checks */ | 2132 | size_t count; /* after file limit checks */ |
2134 | ssize_t written, err; | 2133 | ssize_t written, err; |
2135 | 2134 | ||
2136 | count = 0; | 2135 | count = 0; |
2137 | for (seg = 0; seg < nr_segs; seg++) { | 2136 | err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); |
2138 | const struct iovec *iv = &iov[seg]; | 2137 | if (err) |
2139 | /* | 2138 | return err; |
2140 | * If any segment has a negative length, or the cumulative | ||
2141 | * length ever wraps negative then return -EINVAL. | ||
2142 | */ | ||
2143 | count += iv->iov_len; | ||
2144 | if (unlikely((ssize_t)(count|iv->iov_len) < 0)) | ||
2145 | return -EINVAL; | ||
2146 | if (access_ok(VERIFY_READ, iv->iov_base, iv->iov_len)) | ||
2147 | continue; | ||
2148 | if (!seg) | ||
2149 | return -EFAULT; | ||
2150 | nr_segs = seg; | ||
2151 | count -= iv->iov_len; /* This segment is no good */ | ||
2152 | break; | ||
2153 | } | ||
2154 | pos = *ppos; | 2139 | pos = *ppos; |
2155 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); | 2140 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); |
2156 | /* We can write back this queue in page reclaim. */ | 2141 | /* We can write back this queue in page reclaim. */ |