]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Btrfs: lzo: compressed data size must be less then input size
authorTimofey Titovets <nefelim4ag@gmail.com>
Mon, 29 May 2017 23:18:04 +0000 (02:18 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2017 16:26:01 +0000 (18:26 +0200)
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>
fs/btrfs/lzo.c

index a554856a5f8a6f45d61a83906c8d9ee3869641c0..7e8b0d6a7961f355302da4567387c4f427099f42 100644 (file)
@@ -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]);