Commit f065a553 authored by Richard Weinberger's avatar Richard Weinberger Committed by Sasha Levin

ubifs: Fix regression in ubifs_readdir()

[ Upstream commit a00052a2 ]

Commit c83ed4c9 ("ubifs: Abort readdir upon error") broke
overlayfs support because the fix exposed an internal error
code to VFS.
Reported-by: default avatarPeter Rosin <peda@axentia.se>
Tested-by: default avatarPeter Rosin <peda@axentia.se>
Reported-by: default avatarRalph Sennhauser <ralph.sennhauser@gmail.com>
Tested-by: default avatarRalph Sennhauser <ralph.sennhauser@gmail.com>
Fixes: c83ed4c9 ("ubifs: Abort readdir upon error")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 5fdb4fad
...@@ -454,6 +454,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx) ...@@ -454,6 +454,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment