linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] fs/fat: fix ENOSPC condition of directory entries.
@ 2013-12-23  5:55 NODA, Kai
  2013-12-23 11:05 ` OGAWA Hirofumi
  0 siblings, 1 reply; 3+ messages in thread
From: NODA, Kai @ 2013-12-23  5:55 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: linux-fsdevel, NODA, Kai

From: "NODA, Kai" <nodakai@gmail.com>

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.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
---
 fs/fat/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 3963ede..cf9be44 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -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)) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] fs/fat: fix ENOSPC condition of directory entries.
  2013-12-23  5:55 [PATCH 1/1] fs/fat: fix ENOSPC condition of directory entries NODA, Kai
@ 2013-12-23 11:05 ` OGAWA Hirofumi
  2013-12-23 13:06   ` OGAWA Hirofumi
  0 siblings, 1 reply; 3+ messages in thread
From: OGAWA Hirofumi @ 2013-12-23 11:05 UTC (permalink / raw)
  To: NODA, Kai; +Cc: Andrew Morton, linux-fsdevel

"NODA, Kai" <nodakai@gmail.com> writes:

> From: "NODA, Kai" <nodakai@gmail.com>
>
> 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.
>
> Signed-off-by: NODA, Kai <nodakai@gmail.com>

Looks good.

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Thanks.

> ---
>  fs/fat/dir.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/fat/dir.c b/fs/fat/dir.c
> index 3963ede..cf9be44 100644
> --- a/fs/fat/dir.c
> +++ b/fs/fat/dir.c
> @@ -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)) {

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] fs/fat: fix ENOSPC condition of directory entries.
  2013-12-23 11:05 ` OGAWA Hirofumi
@ 2013-12-23 13:06   ` OGAWA Hirofumi
  0 siblings, 0 replies; 3+ messages in thread
From: OGAWA Hirofumi @ 2013-12-23 13:06 UTC (permalink / raw)
  To: NODA, Kai; +Cc: Andrew Morton, linux-fsdevel

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> writes:

> "NODA, Kai" <nodakai@gmail.com> writes:
>
>> From: "NODA, Kai" <nodakai@gmail.com>
>>
>> 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.
>>
>> Signed-off-by: NODA, Kai <nodakai@gmail.com>
>
> Looks good.
>
> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-23 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23  5:55 [PATCH 1/1] fs/fat: fix ENOSPC condition of directory entries NODA, Kai
2013-12-23 11:05 ` OGAWA Hirofumi
2013-12-23 13:06   ` OGAWA Hirofumi

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).