Skip to content

Commit 5d30e8f

Browse files
richardweinbergergregkh
authored andcommitted
ubifs: Fix regression in ubifs_readdir()
commit a00052a upstream. Commit c83ed4c ("ubifs: Abort readdir upon error") broke overlayfs support because the fix exposed an internal error code to VFS. Reported-by: Peter Rosin <[email protected]> Tested-by: Peter Rosin <[email protected]> Reported-by: Ralph Sennhauser <[email protected]> Tested-by: Ralph Sennhauser <[email protected]> Fixes: c83ed4c ("ubifs: Abort readdir upon error") Signed-off-by: Richard Weinberger <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b8176cc commit 5d30e8f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/ubifs/dir.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,14 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx)
454454

455455
if (err != -ENOENT)
456456
ubifs_err(c, "cannot find next direntry, error %d", err);
457+
else
458+
/*
459+
* -ENOENT is a non-fatal error in this context, the TNC uses
460+
* it to indicate that the cursor moved past the current directory
461+
* and readdir() has to stop.
462+
*/
463+
err = 0;
464+
457465

458466
/* 2 is a special value indicating that there are no more direntries */
459467
ctx->pos = 2;

0 commit comments

Comments
 (0)