Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1154557iol; Sun, 12 Jun 2022 07:37:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzih4mr1KTsP9OYt9zQMIj4egmyJm+Px84Zb09z4e/RODR02pDW9akpdUbsBfrNgfQzHeoS X-Received: by 2002:a63:4a4d:0:b0:401:9f40:26a7 with SMTP id j13-20020a634a4d000000b004019f4026a7mr15042212pgl.282.1655044668154; Sun, 12 Jun 2022 07:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655044668; cv=none; d=google.com; s=arc-20160816; b=PGWs2sbF5I6ZYTC8dxg2ZZ24y1G2LFw1YYyUhfL/6nKkjO6ukGNEDn1X53l/C7S2aA 1G3ALP/08p7OwXB5ahnx9B7JsG5YXpz5cAqFQJQ8a/CsEXl7B2GcmDxg9yNOQPV7Om1b 6/9ogTNyPW7wPNbnjbqLEvN83LO4Cmvf3Nw93+1hPm3wrdsjxOzBzVHo1kPGQ5vG6R/8 V0KZOfolRC7Nre10P7GDEGEHoQ3WEHmniAudAHiHKb6RJ7EYC+NY/xN9pdKGjRSSmFC6 R3dcinfYWhP/Tc1bTT4oS1AhIW7KnYqhaqnPKX5FA4aB11gNgv47RQzsUXC392YJx8Zm amaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=diOrVOPA1DrszPTKQ6G1Sn5TRoaAaysLytyk8w/ytPM=; b=WlU+D6NTpCNXXuLaCssjfeZtVKGQ/mjH7U0QXWc5kqH3r3pXJlOTqh1lhGwJbR3Yi2 Xz3lf24Q9nVDEq85c1D0PkllNGxkDH+1ALfpvay/q5T0rK2QnFKkgOHNZ0447RmlJLUM BFsax/vsM8H2kncbD2wSQpsA/Fv2QDUz42Y6j+49f+ssQlh1s+rAeznwRm5MvyQ8wVQq VJCUGfL/yR/Em0W+u1/6/HrWRj89iM+vYsNhAXCN8o0Yfv9z1JXaJwx0K08FI0Si3HSQ bR/Htux+GaPuFyyzDCBBH73pTUw28CQp5IYtn/hETqlQNKv9rS14FZWGHOWuWtZPOtic qlxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=cEqxsZOp; dkim=pass header.i=@codewreck.org header.s=2 header.b=Z7+Fyk0Y; 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 e62-20020a17090a6fc400b001e2818ea430si4085288pjk.86.2022.06.12.07.37.37; Sun, 12 Jun 2022 07:37:48 -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=@codewreck.org header.s=2 header.b=cEqxsZOp; dkim=pass header.i=@codewreck.org header.s=2 header.b=Z7+Fyk0Y; 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 S234986AbiFLIyQ (ORCPT + 99 others); Sun, 12 Jun 2022 04:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234963AbiFLIyP (ORCPT ); Sun, 12 Jun 2022 04:54:15 -0400 Received: from nautica.notk.org (nautica.notk.org [91.121.71.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 368FA517C2 for ; Sun, 12 Jun 2022 01:54:12 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id 97D35C020; Sun, 12 Jun 2022 10:54:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1655024051; bh=diOrVOPA1DrszPTKQ6G1Sn5TRoaAaysLytyk8w/ytPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEqxsZOpI5UY8L6k/Hyl9zKBUgUhWi3iBUg6SAtx1bW4XJDs8x37Ed3znXtHO5bLH vV6l5qcd9yXSzShsEWowXq9AH5LAPrVIlUypkHj2bA8llA/uKgx2+T9WXfkky8H8HD uy268qCy2OERouN5ewO8UqD8/Rx+LIYYiP1EuxgmSB1QltwB83G3vu8ytmf51YG+t8 pZ0uvws+TWP6bHSlVqTrE9hQg0QmOjy3hbY3n5lcA4nGIggARi2K61OpGQmpJw6hWo laXoHOoWufPuyu2RmHMM5U6/mQcD/Mqzj/eqWW/bxiupIwCZoZyoKdJQLYEtcUE2P+ cxYQ/hTqc+TYA== 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, T_SCC_BODY_TEXT_LINE 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 0F523C009; Sun, 12 Jun 2022 10:54:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1655024050; bh=diOrVOPA1DrszPTKQ6G1Sn5TRoaAaysLytyk8w/ytPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z7+Fyk0YaikTR8PDuzHujHv0wrzZ6pAYvxQ6nilzdjvHQtMbQTqvQF7m7cT5D2lm1 3ZUqWJdzV3yzlq6ob156CtpbKHCood01UscjCfoOh6AfHaMmqoSUqV0s/wH08Bdcf1 RvrBmeKPof54b1OKaWGJKhXuzFJwOGetEVpc86KIMKBMzLyStIU4JurOL08seMZhEd e55j+UTc1NmESduVJLC8FXzlY9JDauq/rZ8AegrtuOoGP8YocXqyG1QhZjSKI8Zrif e/ivgLARLT6UBuSBFgeAEco2IlCNQh6Hw3L7K7naIYVvAioRtSgJYBUfMTP4XnBfag UQICS8ngDN5UQ== Received: from localhost (odin.codewreck.org [local]) by odin.codewreck.org (OpenSMTPD) with ESMTPA id 0605f16d; Sun, 12 Jun 2022 08:54:05 +0000 (UTC) From: Dominique Martinet To: Christian Schoenebeck , Tyler Hicks , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Jianyong Wu Cc: v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 01/06] 9p: fix fid refcount leak in v9fs_vfs_atomic_open_dotl Date: Sun, 12 Jun 2022 17:53:24 +0900 Message-Id: <20220612085330.1451496-2-asmadeus@codewreck.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220612085330.1451496-1-asmadeus@codewreck.org> References: <20220612085330.1451496-1-asmadeus@codewreck.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to release directory fid if we fail halfway through open This fixes fid leaking with xfstests generic 531 Fixes: 6636b6dcc3db ("9p: add refcount to p9_fid struct") Cc: stable@vger.kernel.org Reported-by: Tyler Hicks Signed-off-by: Dominique Martinet --- fs/9p/vfs_inode_dotl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index d17502a738a9..b6eb1160296c 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -274,6 +274,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, if (IS_ERR(ofid)) { err = PTR_ERR(ofid); p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); + p9_client_clunk(dfid); goto out; } @@ -285,6 +286,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, if (err) { p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n", err); + p9_client_clunk(dfid); goto error; } err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags), @@ -292,6 +294,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, if (err < 0) { p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n", err); + p9_client_clunk(dfid); goto error; } v9fs_invalidate_inode_attr(dir); -- 2.35.1