fs/fat: fix ENOSPC condition of directory entries.
Subsystems (2)
PATCH 1/1 fs/fat: fix ENOSPC condition of directory entries.
From: "NODA, Kai" <[email protected]>
FAT_MAX_DIR_ENTRIES entries in a normal directory should be permitted as per the FAT spec. Previously the max number of entries was FAT_MAX_DIR_ENTRIES - 1 due to the bug.
--- fs/fat/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/dir.c +1 -1
@@ -1288,7 +1288,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots, err = -ENOSPC ;while (fat_get_entry (dir, &pos, &bh, &de) >-1 ) {/* check the maximum size of directory */ -if (pos >=FAT_MAX_DIR_SIZE ) +if (pos >FAT_MAX_DIR_SIZE ) goto error;if (IS_FREE (de->name)) {
Signature · 1 line
1.7.9.5
Quoted 7 lines · Kai
From: "NODA, Kai" <[email protected]>
FAT_MAX_DIR_ENTRIESentries in a normal directory should be permitted as per the FAT spec. Previously the max number of entries wasFAT_MAX_DIR_ENTRIES- 1 due to the bug.Signed-off-by NODA, Kai <[email protected]>
Looks good.
Thanks.
Quoted 17 lines
--- fs/fat/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/fat/dir.c +1
-1@@ -1288,7 +1288,7 @@ int fat_add_entries(struct inode *dir, void *slots, int nr_slots, err = -ENOSPC ;while (fat_get_entry (dir, &pos, &bh, &de) >-1 ) {/* check the maximum size of directory */ -if (pos >=FAT_MAX_DIR_SIZE ) +if (pos >FAT_MAX_DIR_SIZE ) goto error;if (IS_FREE (de->name)) {
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 8 lines · OGAWA Hirofumi
Quoted 6 lines · Kai
From: "NODA, Kai" <[email protected]>
FAT_MAX_DIR_ENTRIESentries in a normal directory should be permitted as per the FAT spec. Previously the max number of entries wasFAT_MAX_DIR_ENTRIES- 1 due to the bug.
Quoted 5 lines
Quoted 1 line
Signed-off-by NODA, Kai <[email protected]>Looks good.
Acked-by OGAWA Hirofumi <[email protected]>
NAK, after re-read.
Actually, this was wrong fix. After read last entry of block, fat_get_entry() returns -1. So, pos is not checked. In short, this allows FAT_MAX_DIR_ENTRIES+1, not FAT_MAX_DIR_ENTRIES, right?
Please fix the patch, and really test it.
Signature · 1 line
OGAWA Hirofumi <[email protected]>