diff mbox

btrfs: Call kunmap if zlib_inflateInit2 fails

Message ID 20161102032527.62311-1-nickrterrell@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Nick Terrell Nov. 2, 2016, 3:25 a.m. UTC
If zlib_inflateInit2 fails, the input page is never unmapped.
Add a call to kunmap when it fails.

Signed-off-by: Nick Terrell <nickrterrell@gmail.com>
---
 fs/btrfs/zlib.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba Nov. 2, 2016, 2:23 p.m. UTC | #1
On Tue, Nov 01, 2016 at 08:25:27PM -0700, Nick Terrell wrote:
> If zlib_inflateInit2 fails, the input page is never unmapped.
> Add a call to kunmap when it fails.
> 
> Signed-off-by: Nick Terrell <nickrterrell@gmail.com>

Reviewed-by: David Sterba <dsterba@suse.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/zlib.c b/fs/btrfs/zlib.c
index 88d274e..30e19c9 100644
--- a/fs/btrfs/zlib.c
+++ b/fs/btrfs/zlib.c
@@ -250,6 +250,7 @@  static int zlib_decompress_biovec(struct list_head *ws, struct page **pages_in,
 
 	if (Z_OK != zlib_inflateInit2(&workspace->strm, wbits)) {
 		printk(KERN_WARNING "BTRFS: inflateInit failed\n");
+		kunmap(pages_in[page_in_index]);
 		return -EIO;
 	}
 	while (workspace->strm.total_in < srclen) {