Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8641022rwb; Thu, 24 Nov 2022 02:15:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gzAq0xXLdXaSx06ctMwc3pE1vFyOD7oSjd2Tf070ulns+V7ojtfAw7d/MNzlgp+zvWEeI X-Received: by 2002:a62:6205:0:b0:56c:14a5:2245 with SMTP id w5-20020a626205000000b0056c14a52245mr12947669pfb.12.1669284947740; Thu, 24 Nov 2022 02:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669284947; cv=none; d=google.com; s=arc-20160816; b=K5A8o4ZYSyXdbuhVukBtRbivCxrC7kCwxKUsv8k/CyeR83WO9bLDcN4sewPDuzuqZH gnWFOKNbjqZA1maTWB5gGeqg+mfszT+0Jbgqd68oMlS7+J1JQNZz7oD3mupcKO02VYuc iSTQvcKzH1yJUBc3ruWpkiQgRLnQ+3iHWpziubIy5i4twSLzMvH0kkA1gXPl7mt+fGdg yaEwPTCyWNTPqjdNtxqjZz9f9k6IjPe5GNDoasBVXOnjXjhn5Hg9/WrRzkOXVtZWYhZN 87NdwPPzzgD9BzFCWcuJ5uv5/wsQeOxCZ+OirLVEsXJYCJ63D6T9NjB9JvnuVMM4MEeY SN+g== 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 :dkim-signature; bh=fYK7x/HVlerQ23GUYyPIC3fExRNhf08M/ieWtcdPBaU=; b=d6vpmKGCuBcg6CI1B5+BG+Q4KSXn7tO9nG2EZGYg1MAD9scgpRxlAh9OFFO9C0owfP JS9OYLNvD7Z22S5MfU+XJYNjuMQjRNeMXErbpdRx7emLsXOpGjAc7v2Khh9bjmk6ncGh wlCNMNcNl/LNLkSVaOzbyxbRb+207v6jO1rp/f6qUx82S30eZM+HPCeA6MHNyEhrdcJ3 VDlFAjWzWpqw6iWNv7//jWz8ZAT8+ALOjxfHgo7agPNu+tNktezpiN1YyTXAZcfQWRqD n9O7mTC07I7y5WHwQAvxlgnjPoL9EYv/JbPCCOA6DvhSR+it+io/qucpo9nLXHf2Ls4j e/8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=1g5nuPdh; dkim=pass header.i=@codewreck.org header.s=2 header.b=avBJQWG8; 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=codewreck.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 145-20020a630297000000b004470e9c2e53si940945pgc.591.2022.11.24.02.15.36; Thu, 24 Nov 2022 02:15:47 -0800 (PST) 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=@codewreck.org header.s=2 header.b=1g5nuPdh; dkim=pass header.i=@codewreck.org header.s=2 header.b=avBJQWG8; 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=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbiKXJQV (ORCPT + 87 others); Thu, 24 Nov 2022 04:16:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiKXJQU (ORCPT ); Thu, 24 Nov 2022 04:16:20 -0500 Received: from nautica.notk.org (nautica.notk.org [91.121.71.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67E4A9B7C8; Thu, 24 Nov 2022 01:16:19 -0800 (PST) Received: by nautica.notk.org (Postfix, from userid 108) id 526B2C021; Thu, 24 Nov 2022 10:16:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1669281384; bh=fYK7x/HVlerQ23GUYyPIC3fExRNhf08M/ieWtcdPBaU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=1g5nuPdhzJD/GkzC0n8BVpLRwMHqctNyzHWuXnHbIRgSdRg5WvtNsJ1XXuG8agRZr zxIg4yy3ZZ1jd7ipVbMnXIBgH2/pCsVny9d3Jgled84C3Itij7gD+14+oeKJMSrkmQ Men+YV9uCUEBB6gkh+BvSg0tl2FPljjQkbaEmfVCfP2HJ42V1ww1FZxb4tXBUDjpQ1 /GUao+dZa3uQLTksW45w6Lpjk93KLgOqbJ1dBnt5W/mdqlTedeFg+Y4gEGocC6GS5P g3XXznFJYLWpNm3Tg+wrCm/2RqLT0tcqMHl95NKFSSbTf7TXf03qtO0sa95jd82AnO 2REc39M3j/1Fg== X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 0621EC009; Thu, 24 Nov 2022 10:16:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1669281383; bh=fYK7x/HVlerQ23GUYyPIC3fExRNhf08M/ieWtcdPBaU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=avBJQWG8xUErxoDHN+z/ITJqMCgszKmNs4fnPIdhhIc9+SfeOb70sirpQZLi2Uz6Y HAHGYh2GXqt23vAxe8bbWl6p6MdnQqdHIzaWTOuRigxWC/gez4eULisReRp86HVqSM BPP22jEE+mfGnVuwXZbhh672wYDW7QthBbo9d2EHJHCuPLVL0DO0EiOzYLUpXoANwQ PD1Jz2WSZvtRECzhM6EhupWV2QW7XqBkxBL8J97LihwEJoe+uAdXpU0ODhd+Bn2EQB jMm0JZgyTI11kli7vRvRCA2xKJGi+fVhBvx4xoZnB+lyP5KQBWyf/QfsncxPbbLW6X TqW9ndofVBLNA== Received: from localhost (odin.codewreck.org [local]) by odin.codewreck.org (OpenSMTPD) with ESMTPA id 0f5d5d5a; Thu, 24 Nov 2022 09:16:09 +0000 (UTC) Date: Thu, 24 Nov 2022 18:15:54 +0900 From: asmadeus@codewreck.org To: Wang Hai Cc: ericvh@gmail.com, lucho@ionkov.net, linux_oss@crudebyte.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, viro@zeniv.linux.org.uk, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net] net/9p: Fix a potential socket leak in p9_socket_open Message-ID: References: <20221124081005.66579-1-wanghai38@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221124081005.66579-1-wanghai38@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wang Hai wrote on Thu, Nov 24, 2022 at 04:10:05PM +0800: > Both p9_fd_create_tcp() and p9_fd_create_unix() will call > p9_socket_open(). If the creation of p9_trans_fd fails, > p9_fd_create_tcp() and p9_fd_create_unix() will return an > error directly instead of releasing the cscoket, which will (typo, socket or csocket -- I'll fix this on applying) > result in a socket leak. > > This patch adds sock_release() to fix the leak issue. Thanks, it looks good to me. A bit confusing that sock_alloc_files() calls sock_release() itself on failure, but that means this one's safe at least... > Fixes: 6b18662e239a ("9p connect fixes") (the leak was present before that commit so I guess that's not really correct -- but it might help figure out up to which point stable folks will be able to backport so I guess it's useful either way) -- Dominique