Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4055608rdb; Thu, 14 Sep 2023 10:20:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrXUU32VUd0kknM1Qm8aX+efFsObH0cTo7s85WJ0FPwO0ZGS4XJax8vptWrndWcTDlLFlk X-Received: by 2002:a05:6358:6f86:b0:139:cb15:ecd3 with SMTP id s6-20020a0563586f8600b00139cb15ecd3mr5914759rwn.8.1694712023017; Thu, 14 Sep 2023 10:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694712022; cv=none; d=google.com; s=arc-20160816; b=r0YQ/GyOkBn8hZpxS2rMNK3RP+0rVXGRX2/SffO37uoIFFBs1HZ5z+Aj6PYBGN1Sd3 gxkk0Fa5YOpKy1ypK3PAMzyLmYSO2YPyiZ0zBk9b0fM8vVspwKYgf0W+qhWygD6VVgyJ BT+MDpfog2f8oK6HX0Hn9ZoETHvTqQVyD9mHKNZhcJUnD/eClNZ31+96PqT2t67fEwze QQ1e51u/+6AmxzGOmpCQmKx+l+HkdA6b8sVk5V0iKkME/b73w/LvItesJnVGoryWgjEx WL5l555nldESa/5dLecZGiQQ9kmbm12LPYRqPvCQJSAKmknhuFn0MKwer3bwBXedS6TK xWwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=e+af5j09RXHijicnoPfch2UIrQzegSr6ZHEjvBLEAIc=; fh=iO3DviyEvwPX16ub4z0xRyBx3c+GoI84Svq+5lRV8xI=; b=fltZuBDY1UKcPEUPQEOEjXz1kSg6l3e8gY386oYyhwCvPwLs+GvxDogYzwCmL4BD1i IucbavJDjJv1t6G8bFjSNfJZOfHPb40N5Nf1B9LfCz08yT9iw98qth6EXH1JSzFkWhYg wCPyhCOweiBVb62zE2MObcNDqmwn30l3qQBsl95tW0cbLX8f0k1Fe1RdejcGqhSxCeLw iTA0hhTZc8QbkGZEdVnZ2AZyQOxplI0aeKuhSgcwEf+PwQbFGqLYbQqqbX5YoSemPmDi 4IzuM3k+t3T7/bIL8UxkFRSfZDWeHmYOx1C3lQ1cCkHI8Z9nWIhi+lPNqg+tuNMLGBLm BDwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=rqPZHfBO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d15-20020a63360f000000b0056952b496efsi1708893pga.366.2023.09.14.10.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:20:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=rqPZHfBO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CF3E582B2EB8; Wed, 13 Sep 2023 22:28:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234197AbjINF2r (ORCPT + 99 others); Thu, 14 Sep 2023 01:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234582AbjINF2q (ORCPT ); Thu, 14 Sep 2023 01:28:46 -0400 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E551A8E for ; Wed, 13 Sep 2023 22:28:41 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id geu7qi3W7064Kgeu7qSmeo; Thu, 14 Sep 2023 07:28:40 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1694669320; bh=e+af5j09RXHijicnoPfch2UIrQzegSr6ZHEjvBLEAIc=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=rqPZHfBO5xteKv4Cv1Jt1OblHZxr/1SDkh2R2D7sqGk4eN+eGoTNZ8H5Mkde2bdr4 8V61wNhUfzN8/odkeDrZ4aRbQEBTfQ0gI5cg2Doy7YtDVZ0j7zMOaX4jC6svTNWSll 8D3YigKNfkYMQLFWYZZPeBxVm/0Jb1Vw2bMRYRYUYjl24DVNH/3eJpQ6SkoXeY+8oo 30dVFJxAtzgrKGXoxpGl7ga/+x7gZCY66o9vY0wO1SzbYghS7UdZEn6YJsAXzzg3cr vEi6/SVdvNtLTfirYyM+1/6/ejeJXX5olITJw3xhA42S+n9KHHYDJaVLgdMPI3zgLa Zop3QRBFwv42w== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 14 Sep 2023 07:28:40 +0200 X-ME-IP: 86.243.2.178 Message-ID: <1d1d83df-c1d1-22b0-72a0-291a68d0c328@wanadoo.fr> Date: Thu, 14 Sep 2023 07:28:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH 1/2] bcachefs: Fix a potential in the error handling path of use-after-free inbch2_dev_add() To: Kent Overstreet Cc: Brian Foster , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Kent Overstreet , linux-bcachefs@vger.kernel.org References: <3ab17a294fd2b5fcb180d44955b0d76a28af11cb.1694623395.git.christophe.jaillet@wanadoo.fr> <20230913230135.y27i2bx244tdjhvj@moria.home.lan> Content-Language: fr From: Christophe JAILLET In-Reply-To: <20230913230135.y27i2bx244tdjhvj@moria.home.lan> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 22:28:52 -0700 (PDT) Le 14/09/2023 à 01:01, Kent Overstreet a écrit : > On Wed, Sep 13, 2023 at 06:44:08PM +0200, Christophe JAILLET wrote: >> If __bch2_dev_attach_bdev() fails, bch2_dev_free() is called twice. >> Once here and another time in the error handling path. >> >> This leads to several use-after-free. >> >> Remove the redundant call and only rely on the error handling path. > Thanks, both applied If not too late, it is more a double-free than a use-after-free. And I messed up the ordering of the words in the subject. Sorry about that. CJ