mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
To: linux-ext4@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>,
	linux-kernel@vger.kernel.org, Tao Ma <boyu.mt@taobao.com>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	kernel-dev@igalia.com,
	Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Subject: [PATCH 3/4] ext4: explicitly exit when ext4_find_inline_entry returns an error
Date: Wed, 21 Aug 2024 12:23:23 -0300	[thread overview]
Message-ID: <20240821152324.3621860-4-cascardo@igalia.com> (raw)
In-Reply-To: <20240821152324.3621860-1-cascardo@igalia.com>

__ext4_find_entry currently ignores the return of ext4_find_inline_entry,
except for returning the bh or NULL when has_inline_data is 1.

Even though has_inline_data is set to 1 before calling
ext4_find_inline_entry and would only be set to 0 when that function
returns NULL, check for an encoded error return explicitly in order to
exit.

That makes the code more readable, not requiring that one assumes the cases
when has_inline_data is 1.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
---
 fs/ext4/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 8af437ac3051..14163b32eddb 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1574,7 +1574,7 @@ static struct buffer_head *__ext4_find_entry(struct inode *dir,
 					     &has_inline_data);
 		if (inlined)
 			*inlined = has_inline_data;
-		if (has_inline_data)
+		if (has_inline_data || IS_ERR(ret))
 			goto cleanup_and_exit;
 	}
 
-- 
2.34.1


  parent reply	other threads:[~2024-08-21 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 15:23 [PATCH 0/4] ext4: avoid OOB when system.data xattr changes underneath the filesystem Thadeu Lima de Souza Cascardo
2024-08-21 15:23 ` [PATCH 1/4] ext4: ext4_search_dir should return a proper error Thadeu Lima de Souza Cascardo
2024-08-21 15:23 ` [PATCH 2/4] ext4: return error on ext4_find_inline_entry Thadeu Lima de Souza Cascardo
2024-08-21 15:23 ` Thadeu Lima de Souza Cascardo [this message]
2024-08-21 15:23 ` [PATCH 4/4] ext4: avoid OOB when system.data xattr changes underneath the filesystem Thadeu Lima de Souza Cascardo
2024-09-05 14:53 ` [PATCH 0/4] " Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240821152324.3621860-4-cascardo@igalia.com \
    --to=cascardo@igalia.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=boyu.mt@taobao.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®