* [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode()
@ 2026-03-24 12:48 driz2t
0 siblings, 0 replies; 4+ messages in thread
From: driz2t @ 2026-03-24 12:48 UTC (permalink / raw)
To: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Cc: stable@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 194 bytes --]
Hi,
Please test this patch on stable 6.1.y.
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git f2ddafa93a259310ca47507153b7811ec54ab7fd
Thanks,
Changjian Liu
[-- Attachment #2: 016d861797fd718491a8.patch --]
[-- Type: application/octet-stream, Size: 3163 bytes --]
From e27e3ce3ce3426ad02052bd297b7eb5cbf328e88 Mon Sep 17 00:00:00 2001
From: Changjian Liu <driz2t@qq.com>
Date: Tue, 24 Mar 2026 19:52:36 +0800
Subject: [PATCH] erofs: get rid of z_erofs_fill_inode()
This is a backport of upstream commit 4fdadd5b0f0c723c812842454f8cca1619f2e731.
Prior to big pclusters, non-compact compression indexes could have
empty headers.
Let's just avoid the legacy path since it can be handled properly
as a specific compression header with z_erofs_fill_inode_lazy() too.
Tested with erofs-utils exist versions.
Cc: stable@vger.kernel.org
(cherry picked from commit 4fdadd5b0f0c723c812842454f8cca1619f2e731)
Signed-off-by: Changjian Liu <driz2t@qq.com>
---
fs/erofs/inode.c | 12 ++++++++----
fs/erofs/internal.h | 2 --
fs/erofs/zmap.c | 18 ------------------
| Bin 0 -> 14608 bytes
4 files changed, 8 insertions(+), 24 deletions(-)
create mode 100755 scripts/extract-cert
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 3cbef6318b7b..484572504b4d 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -280,11 +280,15 @@ static int erofs_fill_inode(struct inode *inode)
}
if (erofs_inode_is_data_compressed(vi->datalayout)) {
+#ifdef CONFIG_EROFS_FS_ZIP
if (!erofs_is_fscache_mode(inode->i_sb) &&
- inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
- err = z_erofs_fill_inode(inode);
- else
- err = -EOPNOTSUPP;
+ inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
+ inode->i_mapping->a_ops = &z_erofs_aops;
+ err = 0;
+ goto out_unlock;
+ }
+#endif
+ err = -EOPNOTSUPP;
goto out_unlock;
}
inode->i_mapping->a_ops = &erofs_raw_access_aops;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 126970932805..1a4d08a93339 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -423,12 +423,10 @@ enum {
extern const struct iomap_ops z_erofs_iomap_report_ops;
#ifdef CONFIG_EROFS_FS_ZIP
-int z_erofs_fill_inode(struct inode *inode);
int z_erofs_map_blocks_iter(struct inode *inode,
struct erofs_map_blocks *map,
int flags);
#else
-static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
static inline int z_erofs_map_blocks_iter(struct inode *inode,
struct erofs_map_blocks *map,
int flags)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index d2d7fe826091..ff84533da0c4 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -7,24 +7,6 @@
#include <asm/unaligned.h>
#include <trace/events/erofs.h>
-int z_erofs_fill_inode(struct inode *inode)
-{
- struct erofs_inode *const vi = EROFS_I(inode);
- struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
-
- if (!erofs_sb_has_big_pcluster(sbi) &&
- !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
- vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
- vi->z_advise = 0;
- vi->z_algorithmtype[0] = 0;
- vi->z_algorithmtype[1] = 0;
- vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
- set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
- }
- inode->i_mapping->a_ops = &z_erofs_aops;
- return 0;
-}
-
struct z_erofs_maprecorder {
struct inode *inode;
struct erofs_map_blocks *map;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode()
@ 2026-03-25 6:57 driz2t
2026-03-25 7:15 ` Gao Xiang
0 siblings, 1 reply; 4+ messages in thread
From: driz2t @ 2026-03-25 6:57 UTC (permalink / raw)
To: stable@vger.kernel.org
Cc: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com,
jefflexu@linux.alibaba.com, linux-kernel@vger.kernel.org,
syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
This is a backport of upstream commit 4fdadd5b0f0c723c812842454f8cca1619f2e731.
(erofs: get rid of z_erofs_fill_inode())
Reported-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Tested-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Signed-off-by: Changjian Liu <driz2t@qq.com>
---
fs/erofs/inode.c | 12 ++++++++----
fs/erofs/internal.h | 2 --
fs/erofs/zmap.c | 18 ------------------
scripts/extract-cert | Bin 0 -> 14608 bytes
4 files changed, 8 insertions(+), 24 deletions(-)
create mode 100755 scripts/extract-cert
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 3cbef6318b7b..484572504b4d 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -280,11 +280,15 @@ static int erofs_fill_inode(struct inode *inode)
}
if (erofs_inode_is_data_compressed(vi->datalayout)) {
+#ifdef CONFIG_EROFS_FS_ZIP
if (!erofs_is_fscache_mode(inode->i_sb) &&
- inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
- err = z_erofs_fill_inode(inode);
- else
- err = -EOPNOTSUPP;
+ inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
+ inode->i_mapping->a_ops = &z_erofs_aops;
+ err = 0;
+ goto out_unlock;
+ }
+#endif
+ err = -EOPNOTSUPP;
goto out_unlock;
}
inode->i_mapping->a_ops = &erofs_raw_access_aops;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 126970932805..1a4d08a93339 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -423,12 +423,10 @@ enum {
extern const struct iomap_ops z_erofs_iomap_report_ops;
#ifdef CONFIG_EROFS_FS_ZIP
-int z_erofs_fill_inode(struct inode *inode);
int z_erofs_map_blocks_iter(struct inode *inode,
struct erofs_map_blocks *map,
int flags);
#else
-static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
static inline int z_erofs_map_blocks_iter(struct inode *inode,
struct erofs_map_blocks *map,
int flags)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index d2d7fe826091..ff84533da0c4 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -7,24 +7,6 @@
#include <asm/unaligned.h>
#include <trace/events/erofs.h>
-int z_erofs_fill_inode(struct inode *inode)
-{
- struct erofs_inode *const vi = EROFS_I(inode);
- struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
-
- if (!erofs_sb_has_big_pcluster(sbi) &&
- !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
- vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
- vi->z_advise = 0;
- vi->z_algorithmtype[0] = 0;
- vi->z_algorithmtype[1] = 0;
- vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
- set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
- }
- inode->i_mapping->a_ops = &z_erofs_aops;
- return 0;
-}
-
struct z_erofs_maprecorder {
struct inode *inode;
struct erofs_map_blocks *map;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode()
2026-03-25 6:57 driz2t
@ 2026-03-25 7:15 ` Gao Xiang
0 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2026-03-25 7:15 UTC (permalink / raw)
To: driz2t@qq.com
Cc: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com,
jefflexu@linux.alibaba.com, linux-kernel@vger.kernel.org,
syzbot+016d861797fd718491a8@syzkaller.appspotmail.com,
stable@vger.kernel.org
On 2026/3/25 14:57, driz2t@qq.com wrote:
> This is a backport of upstream commit 4fdadd5b0f0c723c812842454f8cca1619f2e731.
> (erofs: get rid of z_erofs_fill_inode())
>
> Reported-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
> Tested-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
> Signed-off-by: Changjian Liu <driz2t@qq.com>
Please follow the stable patch style.
> ---
> fs/erofs/inode.c | 12 ++++++++----
> fs/erofs/internal.h | 2 --
> fs/erofs/zmap.c | 18 ------------------
> scripts/extract-cert | Bin 0 -> 14608 bytes
scripts/extract-cert | Bin 0 -> 14608 bytes
What's that.
Thanks,
Gao Xiang
> 4 files changed, 8 insertions(+), 24 deletions(-)
> create mode 100755 scripts/extract-cert
>
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index 3cbef6318b7b..484572504b4d 100644
> --- a/fs/erofs/inode.c
> +++ b/fs/erofs/inode.c
> @@ -280,11 +280,15 @@ static int erofs_fill_inode(struct inode *inode)
> }
>
> if (erofs_inode_is_data_compressed(vi->datalayout)) {
> +#ifdef CONFIG_EROFS_FS_ZIP
> if (!erofs_is_fscache_mode(inode->i_sb) &&
> - inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
> - err = z_erofs_fill_inode(inode);
> - else
> - err = -EOPNOTSUPP;
> + inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
> + inode->i_mapping->a_ops = &z_erofs_aops;
> + err = 0;
> + goto out_unlock;
> + }
> +#endif
> + err = -EOPNOTSUPP;
> goto out_unlock;
> }
> inode->i_mapping->a_ops = &erofs_raw_access_aops;
> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
> index 126970932805..1a4d08a93339 100644
> --- a/fs/erofs/internal.h
> +++ b/fs/erofs/internal.h
> @@ -423,12 +423,10 @@ enum {
> extern const struct iomap_ops z_erofs_iomap_report_ops;
>
> #ifdef CONFIG_EROFS_FS_ZIP
> -int z_erofs_fill_inode(struct inode *inode);
> int z_erofs_map_blocks_iter(struct inode *inode,
> struct erofs_map_blocks *map,
> int flags);
> #else
> -static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
> static inline int z_erofs_map_blocks_iter(struct inode *inode,
> struct erofs_map_blocks *map,
> int flags)
> diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
> index d2d7fe826091..ff84533da0c4 100644
> --- a/fs/erofs/zmap.c
> +++ b/fs/erofs/zmap.c
> @@ -7,24 +7,6 @@
> #include <asm/unaligned.h>
> #include <trace/events/erofs.h>
>
> -int z_erofs_fill_inode(struct inode *inode)
> -{
> - struct erofs_inode *const vi = EROFS_I(inode);
> - struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
> -
> - if (!erofs_sb_has_big_pcluster(sbi) &&
> - !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
> - vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
> - vi->z_advise = 0;
> - vi->z_algorithmtype[0] = 0;
> - vi->z_algorithmtype[1] = 0;
> - vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
> - set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
> - }
> - inode->i_mapping->a_ops = &z_erofs_aops;
> - return 0;
> -}
> -
> struct z_erofs_maprecorder {
> struct inode *inode;
> struct erofs_map_blocks *map;
> --
> 2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode()
@ 2026-03-25 11:11 driz2t
0 siblings, 0 replies; 4+ messages in thread
From: driz2t @ 2026-03-25 11:11 UTC (permalink / raw)
To: stable; +Cc: xiang, chao, jefflexu, linux-kernel, syzbot+016d861797fd718491a8
[ Upstream commit 4fdadd5b0f0c723c812842454f8cca1619f2e731 ]
Prior to big pclusters, non-compact compression indexes could have
empty headers.
Avoid the legacy path since it can be handled properly as a specific
compression header with z_erofs_fill_inode_lazy() too.
Tested with existing erofs-utils versions.
Link: https://lore.kernel.org/r/20230413092241.73829-1-hsiangkao@linux.alibaba.com
Link: https://syzkaller.appspot.com/bug?extid=016d861797fd718491a8
Reported-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Tested-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Changjian Liu <driz2t@qq.com>
---
fs/erofs/inode.c | 12 ++++++++----
fs/erofs/internal.h | 2 --
fs/erofs/zmap.c | 18 ------------------
3 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 3cbef6318b7b..484572504b4d 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -280,11 +280,15 @@ static int erofs_fill_inode(struct inode *inode)
}
if (erofs_inode_is_data_compressed(vi->datalayout)) {
+#ifdef CONFIG_EROFS_FS_ZIP
if (!erofs_is_fscache_mode(inode->i_sb) &&
- inode->i_sb->s_blocksize_bits == PAGE_SHIFT)
- err = z_erofs_fill_inode(inode);
- else
- err = -EOPNOTSUPP;
+ inode->i_sb->s_blocksize_bits == PAGE_SHIFT) {
+ inode->i_mapping->a_ops = &z_erofs_aops;
+ err = 0;
+ goto out_unlock;
+ }
+#endif
+ err = -EOPNOTSUPP;
goto out_unlock;
}
inode->i_mapping->a_ops = &erofs_raw_access_aops;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 126970932805..1a4d08a93339 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -423,12 +423,10 @@ enum {
extern const struct iomap_ops z_erofs_iomap_report_ops;
#ifdef CONFIG_EROFS_FS_ZIP
-int z_erofs_fill_inode(struct inode *inode);
int z_erofs_map_blocks_iter(struct inode *inode,
struct erofs_map_blocks *map,
int flags);
#else
-static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
static inline int z_erofs_map_blocks_iter(struct inode *inode,
struct erofs_map_blocks *map,
int flags)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index d2d7fe826091..ff84533da0c4 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -7,24 +7,6 @@
#include <asm unaligned.h="">
#include <trace events="" erofs.h="">
-int z_erofs_fill_inode(struct inode *inode)
-{
- struct erofs_inode *const vi = EROFS_I(inode);
- struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
-
- if (!erofs_sb_has_big_pcluster(sbi) &&
- !erofs_sb_has_ztailpacking(sbi) && !erofs_sb_has_fragments(sbi) &&
- vi->datalayout == EROFS_INODE_COMPRESSED_FULL) {
- vi->z_advise = 0;
- vi->z_algorithmtype[0] = 0;
- vi->z_algorithmtype[1] = 0;
- vi->z_logical_clusterbits = inode->i_sb->s_blocksize_bits;
- set_bit(EROFS_I_Z_INITED_BIT, &vi->flags);
- }
- inode->i_mapping->a_ops = &z_erofs_aops;
- return 0;
-}
-
struct z_erofs_maprecorder {
struct inode *inode;
struct erofs_map_blocks *map;
--
2.43.0</trace></asm></driz2t@qq.com></hsiangkao@linux.alibaba.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-25 11:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 11:11 [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode() driz2t
-- strict thread matches above, loose matches on Subject: below --
2026-03-25 6:57 driz2t
2026-03-25 7:15 ` Gao Xiang
2026-03-24 12:48 driz2t
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox