Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1269517
| From | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: Endless getdents() in vfat filesystem |
| Date | 2015-11-14 19:20 +0100 |
| Message-ID | <quNAC-7sG-19@gated-at.bofh.it> (permalink) |
| References | <quxPc-5G2-7@gated-at.bofh.it> <quGps-2Pe-7@gated-at.bofh.it> <quIrf-42Y-5@gated-at.bofh.it> <quKt4-5k2-3@gated-at.bofh.it> <quKCJ-5Cl-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Richard Weinberger <richard@nod.at> writes:
>>> Yes, it does fixes the problem here, but I can't really comment on the
>>> correctness of the patch.
>>>
>>> Thanks for the quick reponse,
>>
>> I made cleanup and made sure fake_offset is corrected.
>>
>> Richard, Signed-off-by was missed in your patch, so I added. Can you
>> agree to Signed-off-by?
>
> Sure!
Attached updated patch made smaller changes, and with missed Cc: stable.
Andrew, please queue this up.
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
[PATCH] fat: Fix fake_offset handling on error path
[hirofumi@mail.parknet.co.jp: cleanup and make sure to correct fake_offset]
Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger <richard.weinberger@gmail.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
fs/fat/dir.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff -puN fs/fat/dir.c~fat-fake_offset-fix fs/fat/dir.c
--- linux/fs/fat/dir.c~fat-fake_offset-fix 2015-11-14 23:31:45.904700155 +0900
+++ linux-hirofumi/fs/fat/dir.c 2015-11-15 02:45:13.861256766 +0900
@@ -610,9 +610,9 @@ parse_record:
int status = fat_parse_long(inode, &cpos, &bh, &de,
&unicode, &nr_slots);
if (status < 0) {
- ctx->pos = cpos;
+ bh = NULL;
ret = status;
- goto out;
+ goto end_of_dir;
} else if (status == PARSE_INVALID)
goto record_end;
else if (status == PARSE_NOT_LONGNAME)
@@ -654,8 +654,9 @@ parse_record:
fill_len = short_len;
start_filldir:
- if (!fake_offset)
- ctx->pos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry);
+ ctx->pos = cpos - (nr_slots + 1) * sizeof(struct msdos_dir_entry);
+ if (fake_offset && ctx->pos < 2)
+ ctx->pos = 2;
if (!memcmp(de->name, MSDOS_DOT, MSDOS_NAME)) {
if (!dir_emit_dot(file, ctx))
@@ -681,14 +682,19 @@ record_end:
fake_offset = 0;
ctx->pos = cpos;
goto get_new;
+
end_of_dir:
- ctx->pos = cpos;
+ if (fake_offset && cpos < 2)
+ ctx->pos = 2;
+ else
+ ctx->pos = cpos;
fill_failed:
brelse(bh);
if (unicode)
__putname(unicode);
out:
mutex_unlock(&sbi->s_lock);
+
return ret;
}
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Endless getdents() in vfat filesystem Vegard Nossum <vegard.nossum@oracle.com> - 2015-11-14 02:30 +0100
Re: Endless getdents() in vfat filesystem Richard Weinberger <richard.weinberger@gmail.com> - 2015-11-14 11:40 +0100
Re: Endless getdents() in vfat filesystem Vegard Nossum <vegard.nossum@oracle.com> - 2015-11-14 13:50 +0100
Re: Endless getdents() in vfat filesystem OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2015-11-14 16:00 +0100
Re: Endless getdents() in vfat filesystem Richard Weinberger <richard@nod.at> - 2015-11-14 16:10 +0100
Re: Endless getdents() in vfat filesystem OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2015-11-14 19:20 +0100
Re: Endless getdents() in vfat filesystem Vegard Nossum <vegard.nossum@oracle.com> - 2015-11-15 12:10 +0100
Re: Endless getdents() in vfat filesystem Richard Weinberger <richard@nod.at> - 2015-11-15 12:30 +0100
Re: Endless getdents() in vfat filesystem OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2015-11-15 14:00 +0100
csiph-web