Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 2674

kernel-2.6.18-194.11.1.el5.src.rpm

From: Brad Peters <bpeters@redhat.com>
Date: Wed, 10 Sep 2008 19:33:28 -0400
Subject: [nfs] v4: handle old format exports gracefully
Message-id: 48C85948.9000806@redhat.com
O-Subject: Re: [RHEL 5.3 Patch 1/1] Fix: NFSv4 client can panic kernel on server
Bugzilla: 427424
RH-Acked-by: Jeff Layton <jlayton@redhat.com>
RH-Acked-by: Peter Staubach <staubach@redhat.com>
RH-Acked-by: Jeff Layton <jlayton@redhat.com>

RHBZ#:
------
https://bugzilla.redhat.com/show_bug.cgi?id=427424

Description:
------------
The client hits a BUG_ON due to an issue where the server using the old
format exports file creates a situation that needs security negotiation
(but won't actually do so - hence the new exports format).  The server-side
fix is in kernel for rhel 5.2, but we need to get the client-side fix in as
well.

RHEL Version Found:
------------------
NA  Fix for Feature going into 5.1

kABI Status:
------------
No symbols were harmed.

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 9427062..c01d360 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -850,6 +850,11 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
 		error = PTR_ERR(mntroot);
 		goto error_splat_super;
 	}
+	if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+		dput(mntroot);
+		error = -ESTALE;
+		goto error_splat_super;
+	}
 
 	s->s_flags |= MS_ACTIVE;
 	mnt->mnt_sb = s;
@@ -1131,6 +1136,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
 		error = PTR_ERR(mntroot);
 		goto error_splat_super;
 	}
+	if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+		dput(mntroot);
+		error = -ESTALE;
+		goto error_splat_super;
+	}
 
 	s->s_flags |= MS_ACTIVE;
 	mnt->mnt_sb = s;
@@ -1211,6 +1221,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
 		error = PTR_ERR(mntroot);
 		goto error_splat_super;
 	}
+	if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
+		dput(mntroot);
+		error = -ESTALE;
+		goto error_splat_super;
+	}
 
 	s->s_flags |= MS_ACTIVE;
 	mnt->mnt_sb = s;