From patchwork Tue Nov 3 20:36:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 316836 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 AC3E3C4742C for ; Tue, 3 Nov 2020 21:47:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 597B122384 for ; Tue, 3 Nov 2020 21:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604440072; bh=oARIgNijRG8Pl6+cn+GP4H4uHfwg+3dlW+Jk5srX4ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oomegWmcUirmQ/Sz7eyA5bz4F0+JJJkzMs6nyx5lIp35FJXuRN+vszWr7VJ5liKnJ oDgonOzc4P7mtNYEwbEKpIeIRWgCwl4dY/TANbxfxuPsLaSQMfR2yRVgLR9kfe01uT Chiw75XPLoNsYdj1/UlwJIgytIleO4pAvT1Sxvx8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731865AbgKCUus (ORCPT ); Tue, 3 Nov 2020 15:50:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:45178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731852AbgKCUur (ORCPT ); Tue, 3 Nov 2020 15:50:47 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3A18C20719; Tue, 3 Nov 2020 20:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436646; bh=oARIgNijRG8Pl6+cn+GP4H4uHfwg+3dlW+Jk5srX4ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGPwIPuDBgUKDAtaFVa1di27tT9rd8Dy4JfMsOXcPfVQzukl4NCH6LcGN0Hhj0q7m DfpScL+BFISC3O/IXHkM75h02p2zq469dNqhF60zuhorFBZh51MsIC2eCK3s6bQv30 b25i5cE1IKLHLaROpXTswp1lVKol+LX5awjS6RTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+9f864abad79fae7c17e1@syzkaller.appspotmail.com, Eric Biggers , Jan Kara , Theodore Tso Subject: [PATCH 5.9 340/391] ext4: fix leaking sysfs kobject after failed mount Date: Tue, 3 Nov 2020 21:36:31 +0100 Message-Id: <20201103203410.078075024@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Biggers commit cb8d53d2c97369029cc638c9274ac7be0a316c75 upstream. ext4_unregister_sysfs() only deletes the kobject. The reference to it needs to be put separately, like ext4_put_super() does. This addresses the syzbot report "memory leak in kobject_set_name_vargs (3)" (https://syzkaller.appspot.com/bug?extid=9f864abad79fae7c17e1). Reported-by: syzbot+9f864abad79fae7c17e1@syzkaller.appspotmail.com Fixes: 72ba74508b28 ("ext4: release sysfs kobject when failing to enable quotas on mount") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Link: https://lore.kernel.org/r/20200922162456.93657-1-ebiggers@kernel.org Reviewed-by: Jan Kara Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4872,6 +4872,7 @@ cantfind_ext4: failed_mount8: ext4_unregister_sysfs(sb); + kobject_put(&sbi->s_kobj); failed_mount7: ext4_unregister_li_request(sb); failed_mount6: