Return-Path: Received: from mx2.suse.de ([195.135.220.15]:53277 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934866AbcKVWkf (ORCPT ); Tue, 22 Nov 2016 17:40:35 -0500 From: Jiri Slaby To: stable@vger.kernel.org Cc: Richard Weinberger , Jiri Slaby Subject: [patch added to 3.12-stable] ubifs: Fix regression in ubifs_readdir() Date: Tue, 22 Nov 2016 23:39:58 +0100 Message-Id: <20161122224029.29962-10-jslaby@suse.cz> In-Reply-To: <20161122224029.29962-1-jslaby@suse.cz> References: <20161122224029.29962-1-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org List-ID: From: Richard Weinberger This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== 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 Tested-by: Peter Rosin Reported-by: Ralph Sennhauser Tested-by: Ralph Sennhauser Fixes: c83ed4c9dbb35 ("ubifs: Abort readdir upon error") Signed-off-by: Richard Weinberger Signed-off-by: Jiri Slaby --- fs/ubifs/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 0b1d1b046132..a751d1aa0e6a 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -452,6 +452,14 @@ 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; + /* 2 is a special value indicating that there are no more direntries */ ctx->pos = 2; -- 2.10.2