Skip to contentSkip to conversation

(updated) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in filei

PATCH In review Frank Filz 2 participants 3 messages Dec 2, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Frank Filz

author
#0 lore raw

PATCH 1/1 (updated) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in filei

The problem was use of an int32, which when converted to a uint64 is sign extended resulting in a fileid that doesn't fit in 32 bits even though the intent of the function is to fit the fileid into 32 bits.

---
 fs/nfs/inode.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
fs/nfs/inode.c +5 -1
index 314f571..7fe18a0 100644
@@ -89,7 +89,11 @@ int nfs_wait_bit_killable(void *word)
  */
 u64 nfs_compat_user_ino64(u64 fileid)
 {
-	int ino;
+#ifdef CONIFG_COMPAT
+	compat_ulong_t ino;
+#else	
+	unsigned long ino;
+#endif
 
 	if (enable_ino64)
 		return fileid;
Signature · 1 line
1.5.5.6

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 15 lines · Frank Filz

The problem was use of an int32, which when converted to a uint64 is sign extended resulting in a fileid that doesn't fit in 32 bits even though the intent of the function is to fit the fileid into 32 bits.

---
 fs/nfs/inode.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
fs/nfs/inode.c +0 -0
index 314f571..7fe18a0 100644

fs/nfs/inode.c int nfs_wait_bit_killable(void *word) · line 92

Quoted 5 lines
fs/nfs/inode.c +1 -1
@@ -89,7 +89,11 @@ int nfs_wait_bit_killable(void *word)
  */
 u64 nfs_compat_user_ino64(u64 fileid)
 {
-	int ino;
+#ifdef CONIFG_COMPAT
          ^^^^^^^ typo
Quoted 7 lines
fs/nfs/inode.c +4 -0
+	compat_ulong_t ino;
+#else	
+	unsigned long ino;
+#endif
 
 	if (enable_ino64)
 		return fileid;
Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com

A message that is not in the archive (sent off-list or not yet received): 1291313468.3445.1.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

author
#4 lore raw

Re: [PATCH] (try3) Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in fileid

Quoted 1 line

From c501e5e10c5e5b63412c99b2b16f5978738f61c2 Mon Sep 17 00:00:00 2001

From: Frank S. Filz <[email protected]>
Date: Thu, 2 Dec 2010 09:48:16 -0800
Subject: [PATCH] Fix nfs_compat_user_ino64 so it doesn't cause problems if bit 31 or 63 are set in fileid

The problem was use of an int32, which when converted to a uint64 is sign extended resulting in a fileid that doesn't fit in 32 bits even though the intent of the function is to fit the fileid into 32 bits.

---
 fs/nfs/inode.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
fs/nfs/inode.c +5 -1
index 314f571..bc0b938 100644
@@ -89,7 +89,11 @@ int nfs_wait_bit_killable(void *word)
  */
 u64 nfs_compat_user_ino64(u64 fileid)
 {
-	int ino;
+#ifdef CONFIG_COMPAT
+	compat_ulong_t ino;
+#else	
+	unsigned long ino;
+#endif
 
 	if (enable_ino64)
 		return fileid;
Signature · 1 line
1.5.5.6