From patchwork Tue May 10 12:56:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Vincent_Stehl=C3=A9?= X-Patchwork-Id: 9057231 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 68906BF29F for ; Tue, 10 May 2016 12:56:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91C9020114 for ; Tue, 10 May 2016 12:56:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A48542010B for ; Tue, 10 May 2016 12:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751819AbcEJM4i (ORCPT ); Tue, 10 May 2016 08:56:38 -0400 Received: from mga09.intel.com ([134.134.136.24]:57194 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbcEJM4h (ORCPT ); Tue, 10 May 2016 08:56:37 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 10 May 2016 05:56:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,604,1455004800"; d="scan'208";a="949962195" Received: from jazz.nc.intel.com (HELO localhost) ([10.217.217.129]) by orsmga001.jf.intel.com with ESMTP; 10 May 2016 05:56:35 -0700 Received: from vincents by localhost with local (Exim 4.87) (envelope-from ) id 1b07DF-0002cv-Pd; Tue, 10 May 2016 14:56:33 +0200 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= To: linux-btrfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Vincent=20Stehl=C3=A9?= , Chris Mason , Josef Bacik , David Sterba Subject: [PATCH] Btrfs: fix fspath error deallocation Date: Tue, 10 May 2016 14:56:20 +0200 Message-Id: <1462884980-10052-1-git-send-email-vincent.stehle@intel.com> X-Mailer: git-send-email 2.8.0.rc3 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make sure to deallocate fspath with vfree() in case of error in init_ipath(). fspath is allocated with vmalloc() in init_data_container() since commit 425d17a290c0 ("Btrfs: use larger limit for translation of logical to inode"). Signed-off-by: Vincent Stehlé Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Reviewed-by: David Sterba --- fs/btrfs/backref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 80e8472..d309018 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1991,7 +1991,7 @@ struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root, ifp = kmalloc(sizeof(*ifp), GFP_NOFS); if (!ifp) { - kfree(fspath); + vfree(fspath); return ERR_PTR(-ENOMEM); }