]> git.hungrycats.org Git - linux/commitdiff
btrfs: Call kunmap if zlib_inflateInit2 fails
authorNick Terrell <nickrterrell@gmail.com>
Wed, 2 Nov 2016 03:25:27 +0000 (20:25 -0700)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sun, 27 Nov 2016 18:12:22 +0000 (13:12 -0500)
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>
Signed-off-by: David Sterba <dsterba@suse.com>
(cherry picked from commit 9cd09e509cfe3cb78a330b47d53a27e1ed7ceab4)

Conflicts:
fs/btrfs/zlib.c

fs/btrfs/zlib.c

index 82990b8f872b6d455be25196ee88a97eb82bd932..c35c9e5d8cf906a95d8e11d979e40819a3cb7757 100644 (file)
@@ -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) {