Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp754298iog; Mon, 13 Jun 2022 12:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkOcFMIj9NdZhFqnEZXLUBXJSuSRAsP+tr/MJN3vTjlYj8tlIPBpsV1a8Qb4R6Hb1J7jZz X-Received: by 2002:a17:902:7102:b0:168:dcbe:7c50 with SMTP id a2-20020a170902710200b00168dcbe7c50mr599096pll.116.1655147510686; Mon, 13 Jun 2022 12:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655147510; cv=none; d=google.com; s=arc-20160816; b=x2FkuUZuo3vBFRWGtoH9Xtimx/wg5symeALkBl2HeR1ukxgqaQr2rREM8vWzTH9j4z rqHIjyi9lL9r8Of0emPphy5MFfMWlPJhUzadEz0TH9IHDiF97XyXs1L9R8b7vsgGZjwC V1B4iPg2ZpAd88M31b+WTIl85NA0ONwPbTr/qAppMyrzwCzjgY+RbPwgaN3cNf3Q6ot8 04ESy0Bxr9kPulruiuwswYWObUlnpxgdGOArh4v9ZeyWEsVOk0+Lo6oSVPB08e52FTVE oERakR7Zt3eiwOheKmciKFBV6MqtjYaoH5Txu00RHteBc+TJisk2TpFECZ/NyfmosI2Q BeCg== 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-filter; bh=VHKLq2BI+ptgotAr2Y/DtZAYZ5G9EvxX5w++UzCKBJg=; b=vczYXCShQrLpdCrP+tl5pyE6f2d2REwugUqoteVTUpCFrbVnj+mFsPxxaBbvRWBjF9 CXRYi8VyKR5NnpzjoULFECaU0lA0Q+cUkf36/0jsOpC6zzLxzgogpDgLyaYrNApY+TsM +IlCycolWpO1CO8rddNEdo0ImH2Sd2IA4IOQw1wwFWOa2oOhhEok7nO5MD5aZx+f25F5 wxFLwJZ3IyLlWZFeIqSazoeoNwlCO6jWKVkZuyCG+2cucM0iqFZFXZIITnYse4RM8Axa RJBODklDFRSL+YGXTsZlsQ622lPtZ1MiQUMvlWtFDpv+7jVRspdJ9BqA5V/nAq+kzxkq 3SFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="Pzj/hgNU"; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a170903018300b00168b2d83958si12458374plg.133.2022.06.13.12.11.37; Mon, 13 Jun 2022 12:11:50 -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=@linux.microsoft.com header.s=default header.b="Pzj/hgNU"; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344837AbiFMTCB (ORCPT + 99 others); Mon, 13 Jun 2022 15:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346654AbiFMTA4 (ORCPT ); Mon, 13 Jun 2022 15:00:56 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A41892DD69; Mon, 13 Jun 2022 09:29:54 -0700 (PDT) Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id C9DB120BE530; Mon, 13 Jun 2022 09:29:53 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C9DB120BE530 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1655137794; bh=VHKLq2BI+ptgotAr2Y/DtZAYZ5G9EvxX5w++UzCKBJg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Pzj/hgNUG7ikF8xXWIFd7nKIh7dKYgZQNn8csX0Ya4DJiuWAPqmIMkwCf2pOz9QXC ShumvvFjhi9MhqDlX/dLwh85vCqeQkA9nMxUbUFLgfe7oc6hilR6/nNnvKDs1tz9wC TD5WFKlQ3xBp950c4hfCgf6kL7bybeDac2yDEbVQ= Date: Mon, 13 Jun 2022 11:29:50 -0500 From: Tyler Hicks To: Dominique Martinet Cc: Christian Schoenebeck , Eric Van Hensbergen , Latchesar Ionkov , Jianyong Wu , v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 02/06] 9p: fix fid refcount leak in v9fs_vfs_get_link Message-ID: <20220613162950.GC7401@sequoia> References: <20220612085330.1451496-1-asmadeus@codewreck.org> <20220612085330.1451496-3-asmadeus@codewreck.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220612085330.1451496-3-asmadeus@codewreck.org> X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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 2022-06-12 17:53:25, Dominique Martinet wrote: > we check for protocol version later than required, after a fid has > been obtained. Just move the version check earlier. > > Fixes: 6636b6dcc3db ("9p: add refcount to p9_fid struct") > Cc: stable@vger.kernel.org Reviewed-by: Tyler Hicks Tyler > Signed-off-by: Dominique Martinet > --- > fs/9p/vfs_inode.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c > index 55367ecb9442..18c780ffd4b5 100644 > --- a/fs/9p/vfs_inode.c > +++ b/fs/9p/vfs_inode.c > @@ -1250,15 +1250,15 @@ static const char *v9fs_vfs_get_link(struct dentry *dentry, > return ERR_PTR(-ECHILD); > > v9ses = v9fs_dentry2v9ses(dentry); > - fid = v9fs_fid_lookup(dentry); > + if (!v9fs_proto_dotu(v9ses)) > + return ERR_PTR(-EBADF); > + > p9_debug(P9_DEBUG_VFS, "%pd\n", dentry); > + fid = v9fs_fid_lookup(dentry); > > if (IS_ERR(fid)) > return ERR_CAST(fid); > > - if (!v9fs_proto_dotu(v9ses)) > - return ERR_PTR(-EBADF); > - > st = p9_client_stat(fid); > p9_client_clunk(fid); > if (IS_ERR(st)) > -- > 2.35.1 >