tux3: Make tux_readdir() more robust against invalid f_pos

If dir f_pos is invalid position, and current tux_readdir() calls
BUG() as wrong entry.

This patch checks f_pos and more detail of dir entry (from ext4
checker). And additionally, checks f_pos alignment is valid at first.

If f_pos is invalid clearly, this returns -ENOENT as SuSv4's readdir()
says.

If directory entry is invalid, converts from tux_zero_len_error() to
just error message, then skip that block and continue.  [FIXME: If
directory entry is invalid, skips that block, and continue at next
block. What is good behavior?]

Reported-by: "Darrick J. Wong" <darrick.wong@oracle.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
2 files changed