[PATCH] JFS: If unicode conversion fails, operation should fail. (1 of 4)
Dave Kleikamp <[email protected]> Mon, 25 Aug 2003 14:42:17 -0500
| Newsgroups | gmane.comp.file-systems.jfs.patches |
|---|---|
| Message-ID | <[email protected]> |
# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1097 -> 1.1097.1.1 # fs/jfs/jfs_unicode.c 1.3 -> 1.4 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/08/25 [email protected] 1.1097.1.1 # 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. # -------------------------------------------- # diff -Nru a/fs/jfs/jfs_unicode.c b/fs/jfs/jfs_unicode.c --- a/fs/jfs/jfs_unicode.c Mon Aug 25 14:09:55 2003 +++ b/fs/jfs/jfs_unicode.c Mon Aug 25 14:09:55 2003 @@ -68,8 +68,7 @@ jfs_err("jfs_strtoUCS: char2uni returned %d.", charlen); jfs_err("charset = %s, char = 0x%x", codepage->charset, (unsigned char) *from); - to[i] = 0x003f; /* a question mark */ - charlen = 1; + return charlen; } } @@ -99,6 +98,11 @@ uniName->namlen = jfs_strtoUCS(uniName->name, dentry->d_name.name, length, nls_tab); + + if (uniName->namlen < 0) { + kfree(uniName->name); + return -uniName->namlen; + } return 0; }