Commit dba8e88e authored by Richard Weinberger's avatar Richard Weinberger Committed by Ben Hutchings

ubifs: Fix regression in ubifs_readdir()

commit a00052a2 upstream.

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")
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 192d5e7c
...@@ -448,6 +448,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx) ...@@ -448,6 +448,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
out: out:
if (err != -ENOENT) if (err != -ENOENT)
ubifs_err("cannot find next direntry, error %d", err); ubifs_err("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;
kfree(file->private_data); kfree(file->private_data);
file->private_data = NULL; file->private_data = NULL;
......
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