* [PATCH] cifs: fix length calculation for converted unicode readdir names
@ 2010-02-05 18:14 Jeff Layton
2010-02-05 19:27 ` Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2010-02-05 18:14 UTC (permalink / raw)
To: smfrench; +Cc: linux-fsdevel, linux-cifs-client, linux-kernel, stable
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>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: stable@kernel.org
---
fs/cifs/readdir.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index f84062f..f5618f8 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,
min(len, max_len), nlt,
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
+ pqst->len -= nls_nullsize(nlt);
} else {
pqst->name = filename;
pqst->len = len;
--
1.6.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cifs: fix length calculation for converted unicode readdir names
2010-02-05 18:14 [PATCH] cifs: fix length calculation for converted unicode readdir names Jeff Layton
@ 2010-02-05 19:27 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2010-02-05 19:27 UTC (permalink / raw)
To: smfrench; +Cc: linux-fsdevel, linux-cifs-client, linux-kernel, stable
On Fri, 5 Feb 2010 13:14:00 -0500
Jeff Layton <jlayton@redhat.com> wrote:
> 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>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> Cc: stable@kernel.org
To be clear...I think we need to get this into mainline kernels ASAP.
It causes some very subtle bugs in inode refcounting and dcache
handling.
I suspect that it'll fix a number of other oddball problems that have
been reported recently too, but only time and testing will tell that
for sure.
Also, should add Shaggy's Acked-by:
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
> ---
> fs/cifs/readdir.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
> index f84062f..f5618f8 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,
> min(len, max_len), nlt,
> cifs_sb->mnt_cifs_flags &
> CIFS_MOUNT_MAP_SPECIAL_CHR);
> + pqst->len -= nls_nullsize(nlt);
> } else {
> pqst->name = filename;
> pqst->len = len;
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-05 19:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-05 18:14 [PATCH] cifs: fix length calculation for converted unicode readdir names Jeff Layton
2010-02-05 19:27 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).