Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5322427rwb; Wed, 17 Aug 2022 15:36:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR5IIRUvFuxQA31mIgZQLc7BC+g57q4rhnAcUwRi8yE6uya6qeKm3pK3qq8+NfTP1O0f1yc0 X-Received: by 2002:a17:907:6d8b:b0:730:c160:1f9c with SMTP id sb11-20020a1709076d8b00b00730c1601f9cmr111905ejc.342.1660775816200; Wed, 17 Aug 2022 15:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660775816; cv=none; d=google.com; s=arc-20160816; b=fbY05gWh4WPUe2f+rG76Ra/UjM30df5ieBu69OeoO6tXcgfimzjV5kS8nBL9LMVMvR 4+bw1s76kCmkHyfWt/QJ4eNuibzAK8mOjTcJcbCY0/6QQNdBAJEs1G+jR0c4VCBcu+Bz ixgDOBet8nkCluWNLLMeori5wQ7TEUkx3nFMsVOgz7E2SJEUcMc7rPA76OlHGziEUIwn bmiqnQIW5ILFhT8wIc1K+Nvh/xYlmsOYUI4emEJbqmJGiwsEDC7fLKll22032cOQk9+E hydVi0FJD3e96MT1N+B+SgcF7ip8HuvwBmMPtL7O1E4kunCgCaWlydXeaeyXySNZuWDE niXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Gv4gm91440ebvebATmvsp5+QkrmOMcql3PcMRw1CSds=; b=Tco+IZrzKyjwSwdfyANd9wHYHOslSqD3LoCRo2DwgGLIvA/rbOaTu18we2nFkWU1ah ET5XPIHn6YXhmcx2VsNa9RXchpXRrHPYOCg27cD5MySFi4oYFlOXV//TCWF/sqzYg15v 7N5ggPwfuRHO/3VOgJJyFSR9thhuHNY/nM6U3M8r7nlEGFd0urFvYXW1CaWMPI5dDN+d Qv43lQr+rxjcZ3bmMSPpxOKRekNomLH7yp2J/n6FEIJz+VDgsoqV+VbQ4tBpydjZSqdq fH7Mjhv5bYBrLGgeORUzuAbAmxJyf/HZxNFJo6Y+EGaO6uTTP+T+ZHOBll+v8f4EFvL8 +tnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=Pvn+0+y8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e2-20020aa7d7c2000000b0043d7c648352si12429814eds.338.2022.08.17.15.35.56; Wed, 17 Aug 2022 15:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@umich.edu header.s=google-2016-06-03 header.b=Pvn+0+y8; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231939AbiHQWcc (ORCPT + 99 others); Wed, 17 Aug 2022 18:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239084AbiHQWc2 (ORCPT ); Wed, 17 Aug 2022 18:32:28 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCFB0AB4D1; Wed, 17 Aug 2022 15:32:27 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id s11so19250586edd.13; Wed, 17 Aug 2022 15:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=Gv4gm91440ebvebATmvsp5+QkrmOMcql3PcMRw1CSds=; b=Pvn+0+y8ZjVKefEP96ynW4izTjZEWhveap9rRu2sMuArVPQxUYXbhX16n434AWb3Ry iUMT12EJWUUEMXMdiirv+sfUGlU9w22kYu7U9XqcmA2WFdnJWWTjXeBC+HI7weslobUp lVDV/lhZrNu6mPhyN66b54TxCR0e87DlIbrxzhv0PdGEr+iVIgxB3Fp9hFomq/KXPqH5 FszUTqCZIJpdekYG2GV63h1zBm723beLmgUwkgt+w64GfmHCNVNEa1IJkNQHh5WZcWvq XCI9gJbwkr002m/CQ+DZznhVj2t/geIexeauSIQrjimZrgB2khKRT+VvRyOegPlp/v07 nWGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=Gv4gm91440ebvebATmvsp5+QkrmOMcql3PcMRw1CSds=; b=erEfGLprC7hz65aHufd5U2V2ssuaI/PcCHW9udamRjCFjO/3VcB4yVesEF/weEYwgI jZKL1jLv1cJEngcxIxuGc00Z84FZF4Cvt9KXDic7B2DGe+LSGGZH5gSKKeurgy/7VFRb RzMlC103xGA8t569YMuNv/Mrsj4djYb2Y71gQOk6LSjPOLrmnX5GBHmKgM6sKRfvB5Sc Bd2cyREBENKgo1mrp5Ay2KdaEZlD36uJAg5+Esl9HNm7wEhqvpB7iSxoDebPTtbKyDG3 B3tU7choN/32W2t4v7uAh9VHlaHZIvn/YEDmYIMMndn5oQSX0unttPGGth94VPRSpQdD fFig== X-Gm-Message-State: ACgBeo0CctVGifackoykyTPSRqhoFfzqj+1woIo9Pk+mzmiOA4IniBxA U83F+lFNMqESy64wa2jBkDzYSfpnswWiHl1a/g2W6Wow X-Received: by 2002:a05:6402:40c2:b0:440:4ecd:f75f with SMTP id z2-20020a05640240c200b004404ecdf75fmr134536edb.405.1660775546111; Wed, 17 Aug 2022 15:32:26 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Olga Kornievskaia Date: Wed, 17 Aug 2022 18:32:15 -0400 Message-ID: Subject: Re: [RFC] problems with alloc_file_pseudo() use in __nfs42_ssc_open() To: Al Viro Cc: linux-nfs , Olga Kornievskaia , linux-fsdevel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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-nfs@vger.kernel.org On Wed, Aug 17, 2022 at 6:18 PM Al Viro wrote: > > My apologies for having missed that back when the SSC > patchset had been done (and missing the problems after it got > merged, actually). > > 1) if this > r_ino = nfs_fhget(ss_mnt->mnt_sb, src_fh, fattr); > in __nfs42_ssc_open() yields a directory inode, we are screwed > as soon as it's passed to alloc_file_pseudo() - a *lot* of places > in dcache handling would break if we do that. It's not too > nice for a regular file from non-cooperating filesystem, but for > directory ones it's deadly. This inode is created to make an appearance of an opened file to do (an NFS) read, it's never a directory. > 2) if alloc_file_pseudo() fails there, we get an inode leak. It > needs an iput() for that case. As in > if (IS_ERR(filep)) { > res = ERR_CAST(filep); > iput(r_ino); > goto out_free_name; > } > > But I'd like to point out that alloc_file_pseudo() is not inteded for > use on normal filesystem's inodes - the use here *mostly* works > (directories aside), but... Use it on filesystem with non-trivial > default dentry_operations and things will get interesting, etc.