Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2024321rwb; Sun, 14 Aug 2022 19:15:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR7bvwQJEkCwxJ3q9frtYiu5GcO6vxCOFss8oMjpSdj/7I1suENlWkaxvJ5ffnjgOzeI1Yes X-Received: by 2002:a05:6402:2802:b0:43a:9098:55a0 with SMTP id h2-20020a056402280200b0043a909855a0mr12511764ede.179.1660529753612; Sun, 14 Aug 2022 19:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660529753; cv=none; d=google.com; s=arc-20160816; b=h9lLl9FlnYkCWRJ/NTEqxpuLvUfjaXB2amW/5Y9QSyhqaOqW7/B/U+RNRZifJLY5uN aULLECgcH2/tqqeeAdu6r1G5kT96e12PcLOkhZ6s5Uj/XAknPnEo8eCQvbZgZf8UBir9 HGcnW1z8G+p0FVGbHF1NjqkRsmK+2CXKv3RZ4ofNj4jBabb0Emz+7F/C+YmFEsm5Zh8o XpvgqRZDY0jZRF6NVH7UZvqW/8BU+tVn+OtdJRCFzQpGBGuwPi+FgjvpRTrGJxO6yRtJ peaHNWiKL5q0/vgjgGBGCnLB+ttja5/UHH7JK9EwmMRZcocwpIqGDDiC0M4PaxPW0R1A e5Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=HGo0XIO3+DsDYVBd08+wBQXUYY81cjOh3s5tyKuX8Ew=; b=hRZZQSPkiTX/vSACZfWrXLsnpxN6cxmxQGS+DIUiq1XgmWh9PjtcLmmDXrmKXxkywE sZXmjzQSdRw5sId8X2WjonJcsu43Bs7iTF66OfFv0i6xomeEgVFMPsGLmJvymL89VCGF 4SnbCgfjleNKO6JXPwTquPf4+EGR0LACWmhMtSkquIjetloKSZlZ/FNStKYlbOefhaM3 nIJk99xR07hLd/YA5HV/eQPhPmuM5wflBa5frVa7MgRoVzV8NvpRmmphVxAnQA1FGLuv EUKhub3t8/avEmBnyt72hac0RyqauAcedwBcDpviWtT6DlqZAXMBa49RR1Lh3OPeCSN+ 2GpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=GPxc8nC8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020aa7d357000000b0043d1c347df3si6223053edr.152.2022.08.14.19.15.26; Sun, 14 Aug 2022 19:15:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=GPxc8nC8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbiHOBsl (ORCPT + 99 others); Sun, 14 Aug 2022 21:48:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbiHOBsi (ORCPT ); Sun, 14 Aug 2022 21:48:38 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D991311A3D for ; Sun, 14 Aug 2022 18:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HGo0XIO3+DsDYVBd08+wBQXUYY81cjOh3s5tyKuX8Ew=; b=GPxc8nC8lWZ/lo/bc7cKevVkQl unCRB0/xk5GIPpOYjIfnmz6Zfbh5g57noCYsLPWm2IvANFU1mtGm0gjpXAH2FPZmoyrWyZoD+QB3S ef6Uj61oB8Kad7e8tTlwKvq/6frbQUMox+LBM7b0zgjlbroGshoM7qZ6D9AoyZxFCUMtTHYdUvNGf b2eT/UTIg6lp80iLJeaEB3vCW+66v53h32XRzLPkDLS9HNvhwqgnYPe7alOV7hLFHkNa3jf+63g19 A6WeMu1jUBUn/3kfIYjYE4hZ3kWkv8PrAFWpUEspsS2DQaf8/Br7PyCK1lodSvDB4TnGE8JDszfBF M350Ay0g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oNPDP-004OGh-5A; Mon, 15 Aug 2022 01:48:27 +0000 Date: Mon, 15 Aug 2022 02:48:27 +0100 From: Al Viro To: Greg Kroah-Hartman Cc: Christian Brauner , Dongliang Mu , Dongliang Mu , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Carlos Llamas , Suren Baghdasaryan , Kees Cook , syzkaller , linux-kernel Subject: Re: [PATCH] drivers: binderfs: fix memory leak in binderfs_fill_super Message-ID: References: <20220812132124.2053673-1-dzm91@hust.edu.cn> <20220812142423.33wnvnjg6v2h2m3y@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2022 at 02:46:36AM +0100, Al Viro wrote: > On Fri, Aug 12, 2022 at 04:32:28PM +0200, Greg Kroah-Hartman wrote: > > > > It's a bit tricky to follow but d_make_root() always consumes the inode. > > > On success via d_instantiate() and on failure via iput(). So when > > > d_make_root() has been called the inode is off limits. And as soon as > > > d_make_root() has returned successfully we're guaranteed that > > > sb->s_fs_info is cleaned up if a ->put_super() method has been defined. > > > Just fyi. > > > > Ah, thanks, that wasn't obvious at all. > > > > greg k-h > > FWIW, I would rather provide a proper ->kill_sb() and gotten rid of > all that stuff. The thing is, unlike ->put_super(), ->kill_sb() is > called for *anything* that has gotten to foo_fill_super(). Usually > allows to get rid of those "call all of or parts of foo_put_super() > on failure exits" and associated bitrot... > > Like this (completely untested): [snip the patch] PS: that's instead of the patch upstream, not on top of it.