linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix incorrect offset
@ 2023-08-24 15:23 Wang Jianjian
  2023-09-18 14:51 ` Jan Kara
  2023-10-06 18:06 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Jianjian @ 2023-08-24 15:23 UTC (permalink / raw)
  To: linux-ext4; +Cc: Wang Jianjian

The last argumen of ext4_check_dir_entry is dentry offset
int the file.

Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>
---
 fs/ext4/namei.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 94608b7df7e8..33ebd35025bf 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2261,8 +2261,7 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
 	top = data2 + len;
 	while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) {
 		if (ext4_check_dir_entry(dir, NULL, de, bh2, data2, len,
-					 (data2 + (blocksize - csum_size) -
-					  (char *) de))) {
+					(char *)de - data2)) {
 			brelse(bh2);
 			brelse(bh);
 			return -EFSCORRUPTED;
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Fix incorrect offset
  2023-08-24 15:23 [PATCH] ext4: Fix incorrect offset Wang Jianjian
@ 2023-09-18 14:51 ` Jan Kara
  2023-10-06 18:06 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2023-09-18 14:51 UTC (permalink / raw)
  To: Wang Jianjian; +Cc: linux-ext4

On Thu 24-08-23 23:23:24, Wang Jianjian wrote:
> The last argumen of ext4_check_dir_entry is dentry offset
           ^^^ argument

> int the file.
  ^^ in the directory

Maybe you could also add to the changelog: Luckily this error only results
in the wrong offset being printed in the eventual error message.
 
> Signed-off-by: Wang Jianjian <wangjianjian0@foxmail.com>

Otherwise the fix looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/namei.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 94608b7df7e8..33ebd35025bf 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2261,8 +2261,7 @@ static int make_indexed_dir(handle_t *handle, struct ext4_filename *fname,
>  	top = data2 + len;
>  	while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) {
>  		if (ext4_check_dir_entry(dir, NULL, de, bh2, data2, len,
> -					 (data2 + (blocksize - csum_size) -
> -					  (char *) de))) {
> +					(char *)de - data2)) {
>  			brelse(bh2);
>  			brelse(bh);
>  			return -EFSCORRUPTED;
> -- 
> 2.34.3
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Fix incorrect offset
  2023-08-24 15:23 [PATCH] ext4: Fix incorrect offset Wang Jianjian
  2023-09-18 14:51 ` Jan Kara
@ 2023-10-06 18:06 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2023-10-06 18:06 UTC (permalink / raw)
  To: linux-ext4, Wang Jianjian; +Cc: Theodore Ts'o


On Thu, 24 Aug 2023 23:23:24 +0800, Wang Jianjian wrote:
> The last argumen of ext4_check_dir_entry is dentry offset
> int the file.
> 
> 

Applied, thanks!

[1/1] ext4: Fix incorrect offset
      commit: 8fedebb5ea183994aca39af3f80623f5db42fff7

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-06 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 15:23 [PATCH] ext4: Fix incorrect offset Wang Jianjian
2023-09-18 14:51 ` Jan Kara
2023-10-06 18:06 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).