From patchwork Wed Nov 2 03:25:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Terrell X-Patchwork-Id: 9408441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6C01E600C8 for ; Wed, 2 Nov 2016 03:25:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BCA929DB3 for ; Wed, 2 Nov 2016 03:25:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D0D729DB5; Wed, 2 Nov 2016 03:25:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF5A29DB3 for ; Wed, 2 Nov 2016 03:25:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755383AbcKBDZr (ORCPT ); Tue, 1 Nov 2016 23:25:47 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32792 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755379AbcKBDZq (ORCPT ); Tue, 1 Nov 2016 23:25:46 -0400 Received: by mail-pf0-f195.google.com with SMTP id a136so405502pfa.0 for ; Tue, 01 Nov 2016 20:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=I0oRpE7y5rKV4trbDN5U4wPGj0VZoR72ks2w1NhGp/k=; b=slYeqAOqvLhof9Py7M2yNgW4j2QK0jR2RHHfkx3eJQR9pEV7lp8+k7yRz1drZD8UYn pKyZQgIhPoujBA7k625Z4x3nVMv3EJjlNjOovYNuUKP8RNfdgCLpSK7Zl4UY4jtVqjle F6uOYY9eX4exYh303/5NSvP8RdSlo2frzXAQACAdXfycPxb3Xs6YwPav4zCHZL/DF4Un JDwd54z4qpQe3M8UF4HlE3I7pxx/Lb3GVQYIl+CDH/tj0Us+fz2Zi/p75VaQfb7xTcKU +uKWmtQCzeg5uR6qs+0P4zH2qadJxD6wVzw9QUFyUY2O5TNAXx3PWlJ7KTRgoPyi4FiD 81zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=I0oRpE7y5rKV4trbDN5U4wPGj0VZoR72ks2w1NhGp/k=; b=bg+HJ3PxUsmpj4IpOx7TOmW2dyjxSgVslq8gBFhyod8WsazLtfwi/fOw8tVws9e85s VVdL2ecM9P5ftaghX9VJbZg3lxwAQBColPS82cLGBZDlDNfCOqZmapCRmCCIt7jTMRFa Brv8MSjDLttqBuwPyFKRd0n4CF51GIgvSq7dTc8PnbATxr8UkS3TueQ5xA0ogkkP27vA qbUakn5VnJaliNpREJ5uQDoGzVIidnt7DDECCtUotu+f6fIAEYeAYTLhkWSou0rncVjX z9NA0Gh2wuZfgDlm6e4CMKt4QHqFPcVuRbK5ztXgrmFLQkNFjRp+ICs+JsfEPwctAOkm 8F5A== X-Gm-Message-State: ABUngvegEmpgRvs6E6kWzOWzg/7QljNBS3BznUdzU4z/1mS7K6X6Cwv+kMy4EjE+hqV9xA== X-Received: by 10.98.134.78 with SMTP id x75mr2785519pfd.6.1478057145978; Tue, 01 Nov 2016 20:25:45 -0700 (PDT) Received: from terrelln-mbp.thefacebook.com ([199.201.64.131]) by smtp.gmail.com with ESMTPSA id l187sm83396pfc.0.2016.11.01.20.25.45 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 01 Nov 2016 20:25:45 -0700 (PDT) From: Nick Terrell To: linux-btrfs@vger.kernel.org Cc: Nick Terrell Subject: [PATCH] btrfs: Call kunmap if zlib_inflateInit2 fails Date: Tue, 1 Nov 2016 20:25:27 -0700 Message-Id: <20161102032527.62311-1-nickrterrell@gmail.com> X-Mailer: git-send-email 2.10.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If zlib_inflateInit2 fails, the input page is never unmapped. Add a call to kunmap when it fails. Signed-off-by: Nick Terrell Reviewed-by: David Sterba --- fs/btrfs/zlib.c | 1 + 1 file changed, 1 insertion(+) 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) {