ubifs: Fix regression in ubifs_readdir()

Commit c83ed4c9db ("ubifs: Abort readdir upon error") broke
overlayfs support because the fix exposed an internal error
code to VFS.

Reported-by: Peter Rosin <peda@axentia.se>
Tested-by: Peter Rosin <peda@axentia.se>
Reported-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Tested-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Fixes: c83ed4c9db ("ubifs: Abort readdir upon error")
Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Richard Weinberger 2016-10-28 11:49:03 +02:00
parent 40b6e61ac7
commit a00052a296
1 changed files with 8 additions and 0 deletions

View File

@ -543,6 +543,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
if (err != -ENOENT) if (err != -ENOENT)
ubifs_err(c, "cannot find next direntry, error %d", err); ubifs_err(c, "cannot find next direntry, error %d", err);
else
/*
* -ENOENT is a non-fatal error in this context, the TNC uses
* it to indicate that the cursor moved past the current directory
* and readdir() has to stop.
*/
err = 0;
/* 2 is a special value indicating that there are no more direntries */ /* 2 is a special value indicating that there are no more direntries */
ctx->pos = 2; ctx->pos = 2;