From: Timofey Titovets Date: Mon, 29 May 2017 23:18:04 +0000 (+0300) Subject: Btrfs: lzo: compressed data size must be less then input size X-Git-Tag: v4.13-rc1~150^2~67 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1e9d7291e50178699b87656488912eba235c7679;p=karo-tx-linux.git 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 Reviewed-by: David Sterba [ update changelog ] Signed-off-by: David Sterba --- 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]);