Commit c087dbee authored by Dave Kleikamp's avatar Dave Kleikamp

JFS: If unicode conversion fails, operation should fail.

Previously, if an object is created with an illegal character in the
iocharset, JFS substituted a question mark as a substitution character and
allowed the operation to succeed.  This can cause more than on dentry to
be created for the same object, leading to more problems.
parent 0f5c49a1
...@@ -68,8 +68,7 @@ int jfs_strtoUCS(wchar_t * to, ...@@ -68,8 +68,7 @@ int jfs_strtoUCS(wchar_t * to,
jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen); jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen);
jfs_err("charset = %s, char = 0x%x", jfs_err("charset = %s, char = 0x%x",
codepage->charset, (unsigned char) *from); codepage->charset, (unsigned char) *from);
to[i] = 0x003f; /* a question mark */ return charlen;
charlen = 1;
} }
} }
...@@ -100,5 +99,10 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry, ...@@ -100,5 +99,10 @@ int get_UCSname(struct component_name * uniName, struct dentry *dentry,
uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name, uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name,
length, nls_tab); length, nls_tab);
if (uniName->namlen < 0) {
kfree(uniName->name);
return -uniName->namlen;
}
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment