ext4: Reset error code in ext4_find_entry in fallback

Message ID 7b7cc390-eb31-a7c3-a4e6-afad42bd7eec@redhat.com
State Awaiting Upstream
Headers show
Series
  • ext4: Reset error code in ext4_find_entry in fallback
Related show

Commit Message

Eric Sandeen June 6, 2018, 6:49 p.m.
When ext4_find_entry() falls back to "searching the old fashioned
way" due to a corrupt dx dir, it needs to reset the error code
to NULL so that the nonstandard ERR_BAD_DX_DIR code isn't returned
to userspace.

https://bugzilla.kernel.org/show_bug.cgi?id=199947

Reported-by: Anatoly Trosinenko <anatoly.trosinenko@yandex.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Andreas Dilger June 8, 2018, 9:30 p.m. | #1
On Jun 6, 2018, at 12:49 PM, Eric Sandeen <sandeen@redhat.com> wrote:
> 
> When ext4_find_entry() falls back to "searching the old fashioned
> way" due to a corrupt dx dir, it needs to reset the error code
> to NULL so that the nonstandard ERR_BAD_DX_DIR code isn't returned
> to userspace.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=199947
> 
> Reported-by: Anatoly Trosinenko <anatoly.trosinenko@yandex.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index b1f21e3a0763..559b2b9d392a 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -1398,6 +1400,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir,
> 			goto cleanup_and_exit;
> 		dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, "
> 			       "falling back\n"));
> +		ret = NULL;
> 	}
> 	nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
> 	if (!nblocks) {


Cheers, Andreas
Theodore Y. Ts'o July 29, 2018, 9:21 p.m. | #2
On Wed, Jun 06, 2018 at 01:49:46PM -0500, Eric Sandeen wrote:
> When ext4_find_entry() falls back to "searching the old fashioned
> way" due to a corrupt dx dir, it needs to reset the error code
> to NULL so that the nonstandard ERR_BAD_DX_DIR code isn't returned
> to userspace.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=199947
> 
> Reported-by: Anatoly Trosinenko <anatoly.trosinenko@yandex.com>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Applied, thanks.

					- Ted

Patch

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index b1f21e3a0763..559b2b9d392a 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1398,6 +1400,7 @@  static struct buffer_head * ext4_find_entry (struct inode *dir,
 			goto cleanup_and_exit;
 		dxtrace(printk(KERN_DEBUG "ext4_find_entry: dx failed, "
 			       "falling back\n"));
+		ret = NULL;
 	}
 	nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
 	if (!nblocks) {