|
@@ -1817,6 +1817,11 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
|
|
goto out;
|
|
goto out;
|
|
case SEEK_DATA:
|
|
case SEEK_DATA:
|
|
case SEEK_HOLE:
|
|
case SEEK_HOLE:
|
|
|
|
+ if (offset >= i_size_read(inode)) {
|
|
|
|
+ mutex_unlock(&inode->i_mutex);
|
|
|
|
+ return -ENXIO;
|
|
|
|
+ }
|
|
|
|
+
|
|
ret = find_desired_extent(inode, &offset, origin);
|
|
ret = find_desired_extent(inode, &offset, origin);
|
|
if (ret) {
|
|
if (ret) {
|
|
mutex_unlock(&inode->i_mutex);
|
|
mutex_unlock(&inode->i_mutex);
|
|
@@ -1825,11 +1830,11 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin)
|
|
}
|
|
}
|
|
|
|
|
|
if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) {
|
|
if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) {
|
|
- ret = -EINVAL;
|
|
|
|
|
|
+ offset = -EINVAL;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
if (offset > inode->i_sb->s_maxbytes) {
|
|
if (offset > inode->i_sb->s_maxbytes) {
|
|
- ret = -EINVAL;
|
|
|
|
|
|
+ offset = -EINVAL;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|