]> Git Repo - linux.git/commit
fat: fix fake_offset handling on error path
authorOGAWA Hirofumi <[email protected]>
Fri, 20 Nov 2015 23:57:15 +0000 (15:57 -0800)
committerLinus Torvalds <[email protected]>
Sat, 21 Nov 2015 00:17:32 +0000 (16:17 -0800)
commit928a477102c4fc6739883415b66987207e3502f4
tree1b38ac8017f2427750f11806437271634177b6f8
parent1817889e3b2cc1db8abb595712095129ff9156c1
fat: fix fake_offset handling on error path

For the root directory, .  and ..  are faked (using dir_emit_dots()) and
ctx->pos is reset from 2 to 0.

A corrupted root directory could cause fat_get_entry() to fail, but
->iterate() (fat_readdir()) reports progress to the VFS (with ctx->pos
rewound to 0), so any following calls to ->iterate() continue to return
the same entries again and again.

The result is that userspace will never see the end of the directory,
causing e.g.  'ls' to hang in a getdents() loop.

[[email protected]: cleanup and make sure to correct fake_offset]
Reported-by: Vegard Nossum <[email protected]>
Tested-by: Vegard Nossum <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
Signed-off-by: OGAWA Hirofumi <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/fat/dir.c
This page took 0.053237 seconds and 4 git commands to generate.