summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/lzo.c
diff options
context:
space:
mode:
authorTimofey Titovets <nefelim4ag@gmail.com>2017-05-30 02:18:04 +0300
committerDavid Sterba <dsterba@suse.com>2017-06-19 18:26:01 +0200
commit1e9d7291e50178699b87656488912eba235c7679 (patch)
tree5dd825dae958357d95f42b3ea839dd820c5a23b1 /fs/btrfs/lzo.c
parent054ec2f626ed5bc1633addfabb1d8de1b56f949d (diff)
downloadlinux-1e9d7291e50178699b87656488912eba235c7679.tar.gz
linux-1e9d7291e50178699b87656488912eba235c7679.tar.bz2
linux-1e9d7291e50178699b87656488912eba235c7679.zip
Btrfs: lzo: compressed data size must be less then input size
Logic already skips if compression makes data bigger, let's sync lzo with zlib and also return error if compressed size is equal to input size. Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> [ update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/lzo.c')
-rw-r--r--fs/btrfs/lzo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index a554856a5f8a..7e8b0d6a7961 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -230,8 +230,10 @@ static int lzo_compress_pages(struct list_head *ws,
in_len = min(bytes_left, PAGE_SIZE);
}
- if (tot_out > tot_in)
+ if (tot_out >= tot_in) {
+ ret = -E2BIG;
goto out;
+ }
/* store the size of all chunks of compressed data */
cpage_out = kmap(pages[0]);