Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5307257rwb; Wed, 17 Aug 2022 15:18:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR62xFi7705Nz6erFP/+maPgkOdVHM8nJH2HWb7YvVHDWpuPgmnSYp6dtaSr3oamefrfNoZB X-Received: by 2002:a17:90a:c205:b0:1f5:1041:a4ff with SMTP id e5-20020a17090ac20500b001f51041a4ffmr5666242pjt.14.1660774734090; Wed, 17 Aug 2022 15:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660774734; cv=none; d=google.com; s=arc-20160816; b=E/JtNm9jekE8S8UPPgSLuIwET/s1E+BNMMcGPkRdQZWFgjd4ab4InAhXW1W4q7fjhd 5vHl+MSqr2IGD4Xg8zkHb5crCCP34mq+t1rZc8b2A3lH8Vvj1e6RPRJsqKR2PbotBHA2 z7I9KjRDjiTjDew1TkAUxTFX3BpjzY6H9/54uNHiaBsoG5ucBIiD/i1juMJJ9l2ekNUW w2IOHLpQYZyFRSKEt1ZHoAb/wv9GmiPST9mQxP384hq/vDuhj1vIQI43qI9rjWLc4/Ro 1VWxRard7hBqmt/h8uQjUSJjfYCjPWzfLmALMDNrmYwpiTULR/c/ASTN0YXwjtY06TzW OU0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=2JWh42nBBT7KEjqKtK1toMHmrJaPfUqyLAJLBY5gBZ8=; b=A1E+fVlF45sr0o3pv9eswno2RejiG9iXQpOWPPm9wX9G7sD8k9gEfRKmMGxdv1Ty7Q 0qwwDUtSLeeROQUGzO/YnZ72mZfl89a/vubRerkEwa2XoW8A3ChFsW9LxP1NS6qJx5he TBx8B8UeChLwVWWuElYXO3p1VV670Fp147qW5zULxCGrq80j5LCbITdK0A7h+N1JrALC CVuQ0Zt/aZvZNZfU5SfrTg+bi4QMIKhk1ZV/95ZhWogOl/m+pICSJZ2JQ3ezgXDVoDAK 19eNhrAEkvlB4NYij8A0HO9K0qee9ubvxVo52Yt9rFkEczQn7Hp8WGiN+NT7NLtlEuOr fspg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=U+86hu6D; 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=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a170902d70e00b0016f9328bef6si733844ply.602.2022.08.17.15.18.04; Wed, 17 Aug 2022 15:18:54 -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=@linux.org.uk header.s=zeniv-20220401 header.b=U+86hu6D; 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=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240996AbiHQVzW (ORCPT + 99 others); Wed, 17 Aug 2022 17:55:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242016AbiHQVzT (ORCPT ); Wed, 17 Aug 2022 17:55:19 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76756A74DB; Wed, 17 Aug 2022 14:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=2JWh42nBBT7KEjqKtK1toMHmrJaPfUqyLAJLBY5gBZ8=; b=U+86hu6DEq4M7ldnxT6E2aMkwR qfF8RjLR6x+dTlt951HTJuEChS2lirIffUV6nIeTihmT7DIFh8ZPG2USgMPUMK5DB5WUrn7uXAZkL NprxGu/HSzKky+pJg51XTToQ6WVsM8BL3I00Rq4Lg0oUpZ++j5PrML7qkO3ReADWFkJYtPvdOKdn1 ogG+/9Wu8r+pdL7RhcxfqaVMdUxxVGy6qKVLIiZL/IwfwQJtHF0rVbXSjQmYzrh7ec+QUs5BAIpEB Hu2lelL5a0H+ojnx+oA51sBO202BRWewKd/8YUP6XcLwuLN7fahR26+WRN3Hb79oYjFqHwsFjc5+L q+z6vXgA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oOR0M-005VPm-Fg; Wed, 17 Aug 2022 21:55:14 +0000 Date: Wed, 17 Aug 2022 22:55:14 +0100 From: Al Viro To: linux-nfs@vger.kernel.org Cc: Olga Kornievskaia , linux-fsdevel@vger.kernel.org Subject: [RFC] problems with alloc_file_pseudo() use in __nfs42_ssc_open() Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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-nfs@vger.kernel.org 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. 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.