Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5342890ybl; Tue, 10 Dec 2019 04:33:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwNoQe/jdJgmJdNsQxZtxOmxZZv3KJL+S5DkZa7F34vkxgWDo6dcc3t/aLnWTixdglZ2oLM X-Received: by 2002:a9d:5550:: with SMTP id h16mr23965099oti.235.1575981237678; Tue, 10 Dec 2019 04:33:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575981237; cv=none; d=google.com; s=arc-20160816; b=Oegz+eHpFu/rzSkZCvQb36AoSwiwQGK0E75SD/T8de5O9WASZxUNYlitEzSSw+Q3fZ VhIqJcloxjfvb6BS1gPY0dqevBaGW/RY882CfNtVX109nL7uAm4dJE0kmy7UHEV+ls5N xug4xgkgBTKxT8vM843TLKKqj5SSNd7awafNqZ1Zkba/CrW5KIjC12AkdywMIdICNdOz lrWfHhzhavPl+XtcUcM7bQKyfaCcEF/XCevW6EaibvB+ZnSf4xqvUIoehp1yBZWZuKbQ ysS4IrMRqwkqKZu1ypABt4NAGNDtYI5K96e67z1L2SOy+Zj767FVfcero38VPDfz73rh ZSWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=iTwtQMcDj/AiSV92e7jTz17J61UISJVqdTIBvCkXxaw=; b=0X3w/k8ZxYlQLUach3ewEMgQaEyRfgzu4vogD+HmlnUfLx5Wmu6kR/4Zz+E2PLebbn U+I719TU/mqVg45Djp0NhQ9i2zJdT0EoIYRzEZ5BzBrqpc5S3Vodbs8u1JocmHY2GKdv 1ecljfalOtJOnN4ba3CPurykaHQ3fJ+gGFEWHgFrtGEGLlKexcQNjDChV14TBsosOZ1H GJ26gjUHGgz6cQdbi3LMoXm3yGDKv1KHhO91/Sk2JXFHTBCwdw5fCYsDQ8v2U6BriwV1 V0tKWC30etQW7aEPwWS9C3e07nngZc/6nCpWnGH3O6vMnEjmINbl60KnGQYdqRVIomAF mEtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VTNBqBZE; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si1552398oij.125.2019.12.10.04.33.46; Tue, 10 Dec 2019 04:33:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VTNBqBZE; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727505AbfLJMdK (ORCPT + 99 others); Tue, 10 Dec 2019 07:33:10 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:37616 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727448AbfLJMbX (ORCPT ); Tue, 10 Dec 2019 07:31:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575981082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iTwtQMcDj/AiSV92e7jTz17J61UISJVqdTIBvCkXxaw=; b=VTNBqBZEvjYhgI5HMojBG6Kz32+RpsdUd5UE60rSwfXNtEexjrOGRFVIkYfIukvORdd64T bpyefOX1njiP6HUo7J7Y1JxN0NB/Oonqf6AbyghEoiRphczWiyxwBfgfd50Ig+e/vEbdaX dGc1u+GvZpdfXh2jiJlAw/ne1rcNsYM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-pb7EhZwpOB-ESrGlEY7Lvg-1; Tue, 10 Dec 2019 07:31:18 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 36FCE2F29; Tue, 10 Dec 2019 12:31:17 +0000 (UTC) Received: from coeurl.usersys.redhat.com (ovpn-123-90.rdu2.redhat.com [10.10.123.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 183585C219; Tue, 10 Dec 2019 12:31:17 +0000 (UTC) Received: by coeurl.usersys.redhat.com (Postfix, from userid 1000) id D09C620C27; Tue, 10 Dec 2019 07:31:15 -0500 (EST) From: Scott Mayhew To: anna.schumaker@netapp.com, trond.myklebust@hammerspace.com Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH v6 14/27] nfs_clone_sb_security(): simplify the check for server bogosity Date: Tue, 10 Dec 2019 07:31:02 -0500 Message-Id: <20191210123115.1655-15-smayhew@redhat.com> In-Reply-To: <20191210123115.1655-1-smayhew@redhat.com> References: <20191210123115.1655-1-smayhew@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: pb7EhZwpOB-ESrGlEY7Lvg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Al Viro We used to check ->i_op for being nfs_dir_inode_operations. With separate inode_operations for v3 and v4 that became bogus, but rather than going for protocol-dependent comparison we could've just checked ->i_fop instead; _that_ is the same for all protocol versions. Reviewed-by: David Howells Signed-off-by: Al Viro --- fs/nfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2bcf0f8295e0..bec6c341f72c 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2578,7 +2578,7 @@ int nfs_clone_sb_security(struct super_block *s, stru= ct dentry *mntroot, =09unsigned long kflags =3D 0, kflags_out =3D 0; =20 =09/* clone any lsm security options from the parent to the new sb */ -=09if (d_inode(mntroot)->i_op !=3D NFS_SB(s)->nfs_client->rpc_ops->dir_ino= de_ops) +=09if (d_inode(mntroot)->i_fop !=3D &nfs_dir_operations) =09=09return -ESTALE; =20 =09if (NFS_SB(s)->caps & NFS_CAP_SECURITY_LABEL) --=20 2.17.2