Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1631321rwb; Wed, 28 Sep 2022 23:17:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EmPKS52dPT6tV+pk3xm91nPn38I3suFVugCNa8x5q6QMOpZvT/gUhDDLW4y1wtqAxw0ah X-Received: by 2002:a17:902:e841:b0:177:82b6:e6f7 with SMTP id t1-20020a170902e84100b0017782b6e6f7mr1942346plg.66.1664432267794; Wed, 28 Sep 2022 23:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664432267; cv=none; d=google.com; s=arc-20160816; b=00BD2scJrpz9RLyK6CYgIFGdQQUvZ+hiCvQuePO9tOGkC/cYUyV7d3BKQRgSX1Y2+6 GXs2zxDbyKPii8HbIw0DAjz469JzJSj1apLRpU4dwSmhUA+L1779gtLi47/R3Byu80NF wyIRFZHsuJONDk8W2VXKTHbi+L83AYNBMU19vf6zZrGZ+dJmrMBzAesn3FEz/KvyVy/B j7vTf1wBtkj3IAJ7fGkQ3zaPAvrcILvVLQGEq3f1+7RnV9CYX4CsSeZgepEPWKuFTclP R7+AWhbTvD1v5I/Yj6yvZLOuzKX9IB1xnyaxemlfJ0daOQxarGUiaqnqw6y8SEVQV7lp 7YpQ== 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=b6fbfU9gi0snzzejOeEzrU2sbLgK+W1PTjhzilDeqEg=; b=WjLI1BAxCbm7SuRJmnfX3uqHeSygfgH05Iss5itYGHTXp7QVaY9TyxPjtEYnePRXD+ c2nctvowSkdTKZW4SjY6U+Fw6jhCESx6uZvvZDlo2U7tS6138L6/pT1R4U8bFfj38Ltp E1iuvLwYx0JUpQl21k0SZdNru14Qgk/zHbkd5/r+QOsySQaQjymtXur3YS9xtM9l7HJl U7uqTdXpLuuh0DR0oruY3NgVlv5cAoTUqgOWNcHh9SJuf0npW5Rxzuc2wlQXY6/0d418 ktccckaIRVSlKprReQB5Q1aZEf6JZ+mvfnF/x76Dr5tNcpCWGu0m13tE3Kem2+HAJdya hc0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DK+7r5yd; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c23-20020a637257000000b0041ce0347bc3si8433959pgn.354.2022.09.28.23.17.34; Wed, 28 Sep 2022 23:17:47 -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=@kernel.org header.s=k20201202 header.b=DK+7r5yd; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234872AbiI2GKR (ORCPT + 99 others); Thu, 29 Sep 2022 02:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234820AbiI2GKN (ORCPT ); Thu, 29 Sep 2022 02:10:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86452419A8; Wed, 28 Sep 2022 23:10:10 -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 ams.source.kernel.org (Postfix) with ESMTPS id 379DDB8233F; Thu, 29 Sep 2022 06:10:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E3AEC43470; Thu, 29 Sep 2022 06:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664431807; bh=7xmld9n+ZLflyYVZz9glPsXOPPIb/gqWQ8A/fN+pZ54=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DK+7r5ydZMxp87D2zNRYNIdT0cZ5cYfu9nq3mKD9uJW1HIP4axW6y2mtMFDbflQt1 DsJe/SuoQ7Uug+VddWBQy6CgspEYI1uBsmXG3ZCBUpWAmXjRIFvLn1vMFe8/Us298k Rv054bf0QFjnFHQXN4lZhbvQt8MFPhPHAWHsXl/G0Gf4MDNHC86srEMYWWXwWbhFsR jlGDP3Kpf5CLP+3SmFjT1ayifVf81Qsf94vp/AHoIqufh06G2N9XSRw4xzBU8AhCHa ba/fJQJMYNisrCi5lA2eE9/ToZQ9wUyMBh1exyuP8kGoeWJVf9fYRRyB5X1TYmqz76 uRcV5Y0lZBkJQ== Date: Thu, 29 Sep 2022 09:10:03 +0300 From: Leon Romanovsky To: asmadeus@codewreck.org Cc: Christian Schoenebeck , syzbot , davem@davemloft.net, edumazet@google.com, ericvh@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, lucho@ionkov.net, netdev@vger.kernel.org, pabeni@redhat.com, syzkaller-bugs@googlegroups.com, v9fs-developer@lists.sourceforge.net Subject: Re: [syzbot] KASAN: use-after-free Read in rdma_close Message-ID: References: <00000000000015ac7905e97ebaed@google.com> <1783490.kFEjeSjHVE@silver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.2 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 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 Thu, Sep 29, 2022 at 06:52:56AM +0900, asmadeus@codewreck.org wrote: <...> > > From technical perspective, yes, destruction in reverse order is usually the > > better way to go. Whether I would carve that in stone, without any exception, > > probably not. > > I think it's a tradeoff really. > Unrolling in place is great, don't get me wrong, but it's also easy to > miss things when adding code later on -- we actually just did that and > got another kasan report which made me factor things in to future-proof > the code. > > Having a single place of truth that knows how to "untangle" and properly > free a struct, making sure it is noop for parts of the struct that > haven't been initialized yet, is less of a burden for me to think about. It is not bikeshedding or tradeoff, but matter of well-proven coding patterns, which are very helpful for review and code maintaining. Thanks