summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2016-10-28 11:49:03 +0200
committerBen Hutchings <ben@decadent.org.uk>2017-02-23 03:54:24 +0000
commitdba8e88e9827d87f1210c8ae392542508aecbd13 (patch)
tree1cb1f9f2d70803d2b581a7d70073c2b2f27c39a7 /fs/ubifs
parent192d5e7c1ccfe5c6391bfc7090d28204a95984bd (diff)
downloadlinux-stable-dba8e88e9827d87f1210c8ae392542508aecbd13.tar.gz
linux-stable-dba8e88e9827d87f1210c8ae392542508aecbd13.tar.bz2
linux-stable-dba8e88e9827d87f1210c8ae392542508aecbd13.zip
ubifs: Fix regression in ubifs_readdir()
commit a00052a296e54205cf238c75bd98d17d5d02a6db upstream. Commit c83ed4c9dbb35 ("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: c83ed4c9dbb35 ("ubifs: Abort readdir upon error") Signed-off-by: Richard Weinberger <richard@nod.at> [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/dir.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 12caf1ab5f5a..062f0d63dec6 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -448,6 +448,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
out:
if (err != -ENOENT)
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);
file->private_data = NULL;