From: Timofey Titovets <nefelim4ag@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Timofey Titovets <nefelim4ag@gmail.com>
Subject: [PATCH v5 1/2] Btrfs: lzo.c - compressed data size must be less then input size
Date: Tue, 30 May 2017 02:18:04 +0300 [thread overview]
Message-ID: <20170529231805.4797-2-nefelim4ag@gmail.com> (raw)
In-Reply-To: <20170529231805.4797-1-nefelim4ag@gmail.com>
Logic already return error if compression
make data bigger, let's sync logic with zlib
and also return error if compressed size
are equal to input size
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
fs/btrfs/lzo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index f48c8c14..f66691e0 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -229,8 +229,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]);
--
2.13.0
next prev parent reply other threads:[~2017-05-29 23:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 23:18 [PATCH v5 0/2] Btrfs: compression fixes Timofey Titovets
2017-05-29 23:18 ` Timofey Titovets [this message]
2017-06-05 15:59 ` [PATCH v5 1/2] Btrfs: lzo.c - compressed data size must be less then input size David Sterba
2017-05-29 23:18 ` [PATCH v5 2/2] Btrfs: compression must free at least one sector size Timofey Titovets
2017-06-05 16:10 ` David Sterba
2017-06-05 18:56 ` Timofey Titovets
2017-06-06 11:22 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170529231805.4797-2-nefelim4ag@gmail.com \
--to=nefelim4ag@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).