Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4700965rwb; Wed, 17 Aug 2022 04:51:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7+5/+dbOwVI86Lgi4wu2NYqPcXhx+qRCHOK+pG8q2MAce3msHsFeG0zRpwexRLtUtpoFUs X-Received: by 2002:a05:6402:1d54:b0:43d:280c:f25b with SMTP id dz20-20020a0564021d5400b0043d280cf25bmr23251982edb.379.1660737085867; Wed, 17 Aug 2022 04:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660737085; cv=none; d=google.com; s=arc-20160816; b=g/qo20FO/Ibl5c03s4a734lp06PYb1PpR6tBBsPjE/5DDmyaD9v5yVkcd6oPNGOiKa Eg7sPiKPqR6UzbsOe1N8TkUmAJUkwql53b0SZTq2fuDleagicrQwK/+oWpNFY6Itk2Mw iJ//lqesw+5gqnSLolT6nICbYOBpZgBNQxWt1O9t0lgul96jG3FSDVpumyyju8GHW/Ad pZw+IIdOJOW1BYSDcUzwO1j71j/Ki8+S3HLe0Mht4Vnbuk22rOcrnLfsQ/h+8RVasUKg OCQ0arIEMSxUzXotQieR1Py4mxfZK8qqPr1WOueKsXCjCLQ5OjB3OuNrm1b/TpugYB72 5zUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k6M4Kb7rgDUuQFVos+RGL8pAb52BcK4k8wWkee+S5gM=; b=JerzDosGtb5/b+CJYhfMMBq0u8LN/8tWLYQNoxIbnbWi8hmFE2GfEVcDV4hVQTkFrr iCa4LUCXLmNCisXuRv0dsK/wmc6PAaj1GQSosj3GNmMp7U6zrwThnHYoKlMdtiuxIxJx TfDjVTFU9TWojFVu86PWAlQ0Omx15XQ/7GNAmQb2I2kP5aHq2PGW9YxO0g68caWpv0Ke IYkrbRW4JTTOUpYDRDVYg9Pp0FkNHNEOfQ4QffOI3oiOmkKgx07pbY3lVBJc38/AxiUA nTXDJUhPA7RHGz5zJt6iYJvi8fNPUhrSju80raHCGR3ZDSjKWxY0tR+iEun8Kon1WXFB t8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sg9qReUS; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a056402350800b0043d99f453f1si12928861edd.64.2022.08.17.04.50.54; Wed, 17 Aug 2022 04:51:25 -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=@linuxfoundation.org header.s=korg header.b=Sg9qReUS; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236234AbiHQLnN (ORCPT + 99 others); Wed, 17 Aug 2022 07:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiHQLnL (ORCPT ); Wed, 17 Aug 2022 07:43:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D11F08 for ; Wed, 17 Aug 2022 04:43:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ABD5B614F6 for ; Wed, 17 Aug 2022 11:43:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85D20C433C1; Wed, 17 Aug 2022 11:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660736590; bh=sFY46UNg5CyoYSYYJBPY2dZP0am3MG7vM+ocfRkA/ek=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Sg9qReUSN5d0V0h6icFFCOhqPV3dp/HoEqncnSLJ8oksVncPxj2Hn9D2RsC3G97Ld TYhZUsInfDApIy1iUiRpdsE4FjIiN9XPOXXJs+tt7zQJiCLHib2OWXrR5bafHYI7J0 on4BBjmfrFdFKfplZptQR5wXIx9kNvGaK7VGcLwg= Date: Wed, 17 Aug 2022 13:43:07 +0200 From: Greg Kroah-Hartman To: Christian Brauner Cc: Al Viro , 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> <20220815084740.2jpqud4htermrdko@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220815084740.2jpqud4htermrdko@wittgenstein> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 10:47:40AM +0200, Christian Brauner wrote: > 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): > > > > Signed-off-by: Al Viro > > --- > > Sounds good, > Reviewed-by: Christian Brauner (Microsoft) Looks much better to me too. Can someone (Christian?) turn this into a real patch that I can apply? thanks, greg k-h