From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D3ADC04AB3 for ; Mon, 27 May 2019 14:02:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8F6C20717 for ; Mon, 27 May 2019 14:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558965776; bh=ups8gQj+8r1xdwI+8TyaF2Kc2Lsfg3sv3YUdO4b9JLA=; h=Subject:To:Cc:From:Date:List-ID:From; b=jrS8wkda97rrg8BmBT+k+C+XqtZL9pUgH3khGziK9UdA5hBHgaSg/YPED9Mh5e5n4 L2PmvRUihqSBtso/cd/igQ7IdApthowC/7rpfeMjWOZoXh8fzswfsvh8dJtR3adByB bF1TYV5c0KGdt3xEaUP3LJdOiNx9mEbMojM1LBHI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726388AbfE0OCz (ORCPT ); Mon, 27 May 2019 10:02:55 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:48639 "EHLO wout5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbfE0OCz (ORCPT ); Mon, 27 May 2019 10:02:55 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id C3E824FF; Mon, 27 May 2019 10:02:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 27 May 2019 10:02:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=8fCfOa Ead/+I53qT12vIoubNrHdD6sRg6+ajfEyOcuk=; b=tI29OX1s9S1nO2nrxEDtYK xRNlz+iH/Ya4/gObyoKrRFe8f6oQHmGr4KmhS1ixEj2KyLGabnjOPznVGWRq8XeA GntMx1T69E4/wRrO4iQfZTFhiKVOEJwX9az0KhBmADtPSB518Ln7YnF6d5+8c9lu ePZzEaiJE/zH9bv2Wb0aASk3Kc/4L7fTsfBzbRxTq8Fk4LbeP/4MBN9IjHlnBQyu KefuxrPpG813kpxG06w/d1elKK/4MUq91G70wc2fWpWMsJ6/4CvI/7Q4WWi1s/NG 1NV007YEL37gKACqPTdqG7oqXBEt/2LHccDAMhdkhlNV6rKR5SewxCjE9s/4fdOw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddruddvvddgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 72785380083; Mon, 27 May 2019 10:02:52 -0400 (EDT) Subject: FAILED: patch "[PATCH] btrfs: sysfs: Fix error path kobject memory leak" failed to apply to 4.4-stable tree To: tobin@kernel.org, dsterba@suse.com, gregkh@linuxfoundation.org Cc: From: Date: Mon, 27 May 2019 16:02:50 +0200 Message-ID: <1558965770160137@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 450ff8348808a89cc27436771aa05c2b90c0eef1 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 13 May 2019 13:39:11 +1000 Subject: [PATCH] btrfs: sysfs: Fix error path kobject memory leak If a call to kobject_init_and_add() fails we must call kobject_put() otherwise we leak memory. Calling kobject_put() when kobject_init_and_add() fails drops the refcount back to 0 and calls the ktype release method (which in turn calls the percpu destroy and kfree). Add call to kobject_put() in the error path of call to kobject_init_and_add(). Cc: stable@vger.kernel.org # v4.4+ Reviewed-by: Greg Kroah-Hartman Signed-off-by: Tobin C. Harding Reviewed-by: David Sterba Signed-off-by: David Sterba diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f79e477a378e..9bcb3570750e 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3882,8 +3882,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags) info->space_info_kobj, "%s", alloc_name(space_info->flags)); if (ret) { - percpu_counter_destroy(&space_info->total_bytes_pinned); - kfree(space_info); + kobject_put(&space_info->kobj); return ret; }