···502502 *outlen = utf8s_to_utf16s(name, len, (wchar_t *)outname);503503 if (*outlen < 0)504504 return *outlen;505505- else if (*outlen > 255)505505+ else if (*outlen > FAT_LFN_LEN)506506 return -ENAMETOOLONG;507507508508 op = &outname[*outlen * sizeof(wchar_t)];509509 } else {510510 if (nls) {511511 for (i = 0, ip = name, op = outname, *outlen = 0;512512- i < len && *outlen <= 255;512512+ i < len && *outlen <= FAT_LFN_LEN;513513 *outlen += 1)514514 {515515 if (escape && (*ip == ':')) {···549549 return -ENAMETOOLONG;550550 } else {551551 for (i = 0, ip = name, op = outname, *outlen = 0;552552- i < len && *outlen <= 255;552552+ i < len && *outlen <= FAT_LFN_LEN;553553 i++, *outlen += 1)554554 {555555 *op++ = *ip++;···701701 return fat_search_long(dir, qname->name, len, sinfo);702702}703703704704+/*705705+ * (nfsd's) anonymous disconnected dentry?706706+ * NOTE: !IS_ROOT() is not anonymous (I.e. d_splice_alias() did the job).707707+ */708708+static int vfat_d_anon_disconn(struct dentry *dentry)709709+{710710+ return IS_ROOT(dentry) && (dentry->d_flags & DCACHE_DISCONNECTED);711711+}712712+704713static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,705714 struct nameidata *nd)706715{···738729 }739730740731 alias = d_find_alias(inode);741741- if (alias && !(alias->d_flags & DCACHE_DISCONNECTED)) {732732+ if (alias && !vfat_d_anon_disconn(alias)) {742733 /*743743- * This inode has non DCACHE_DISCONNECTED dentry. This744744- * means, the user did ->lookup() by an another name745745- * (longname vs 8.3 alias of it) in past.734734+ * This inode has non anonymous-DCACHE_DISCONNECTED735735+ * dentry. This means, the user did ->lookup() by an736736+ * another name (longname vs 8.3 alias of it) in past.746737 *747738 * Switch to new one for reason of locality if possible.748739 */···752743 iput(inode);753744 unlock_super(sb);754745 return alias;755755- }746746+ } else747747+ dput(alias);748748+756749out:757750 unlock_super(sb);758751 dentry->d_op = sb->s_root->d_op;
+2-1
include/linux/msdos_fs.h
···1515#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */1616#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))1717#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */1818+#define MSDOS_LONGNAME 256 /* maximum name length */1819#define CF_LE_W(v) le16_to_cpu(v)1920#define CF_LE_L(v) le32_to_cpu(v)2021#define CT_LE_W(v) cpu_to_le16(v)···4847#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */4948#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)50495050+#define FAT_LFN_LEN 255 /* maximum long name length */5151#define MSDOS_NAME 11 /* maximum name length */5252-#define MSDOS_LONGNAME 256 /* maximum name length */5352#define MSDOS_SLOTS 21 /* max # of slots for short and long names */5453#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */5554#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */