aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2010-02-05 13:14:00 -0500
committerSteve French <sfrench@us.ibm.com>2010-02-06 01:25:16 -0500
commitf12f98dba6ea1517cd7fbb912208893b9c014c15 (patch)
treef191cf3d7c5569215fd3ca1e41e1eb3d32fbfda6
parentdfae0acd26aebbbafde038617892df728194f4ae (diff)
cifs: fix length calculation for converted unicode readdir names
cifs_from_ucs2 returns the length of the converted name, including the length of the NULL terminator. We don't want to include the NULL terminator in the dentry name length however since that'll throw off the hash calculation for the dentry cache. I believe that this is the root cause of several problems that have cropped up recently that seem to be papered over with the "noserverino" mount option. More confirmation of that would be good, but this is clearly a bug and it fixes at least one reproducible problem that was reported. This patch fixes at least this reproducer in this kernel.org bug: http://bugzilla.kernel.org/show_bug.cgi?id=15088#c12 Reported-by: Bjorn Tore Sund <bjorn.sund@it.uib.no> Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Cc: stable@kernel.org Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/readdir.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index f84062f9a985..f5618f8cc462 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -666,6 +666,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
666 min(len, max_len), nlt, 666 min(len, max_len), nlt,
667 cifs_sb->mnt_cifs_flags & 667 cifs_sb->mnt_cifs_flags &
668 CIFS_MOUNT_MAP_SPECIAL_CHR); 668 CIFS_MOUNT_MAP_SPECIAL_CHR);
669 pqst->len -= nls_nullsize(nlt);
669 } else { 670 } else {
670 pqst->name = filename; 671 pqst->name = filename;
671 pqst->len = len; 672 pqst->len = len;