浏览代码

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>
Timofey Titovets 8 年之前
父节点
当前提交
1e9d7291e5
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      fs/btrfs/lzo.c

+ 3 - 1
fs/btrfs/lzo.c

@@ -230,8 +230,10 @@ static int lzo_compress_pages(struct list_head *ws,
 		in_len = min(bytes_left, PAGE_SIZE);
 		in_len = min(bytes_left, PAGE_SIZE);
 	}
 	}
 
 
-	if (tot_out > tot_in)
+	if (tot_out >= tot_in) {
+		ret = -E2BIG;
 		goto out;
 		goto out;
+	}
 
 
 	/* store the size of all chunks of compressed data */
 	/* store the size of all chunks of compressed data */
 	cpage_out = kmap(pages[0]);
 	cpage_out = kmap(pages[0]);