* [f2fs-dev] [PATCH] f2fs: fix listxattr handling of corrupted xattr entries
@ 2026-06-18 20:01 ` Keshav Verma
0 siblings, 0 replies; 6+ messages in thread
From: Keshav Verma @ 2026-06-18 20:01 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-kernel, iganschel, linux-f2fs-devel
Validate the xattr entry before reading its fields in f2fs_listxattr().
Return -EFSCORRUPTED when the entry is outside the valid xattr storage
area instead of returning a successful partial result.
Signed-off-by: Keshav Verma <iganschel@gmail.com>
---
fs/f2fs/xattr.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 610d5810074d..18f495db20d2 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -581,8 +581,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
size_t prefix_len;
size_t size;
- prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
-
if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
(void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
@@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
f2fs_handle_error(F2FS_I_SB(inode),
ERROR_CORRUPTED_XATTR);
- break;
+ error = -EFSCORRUPTED;
+ goto cleanup;
}
+ prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
+
if (!prefix)
continue;
--
2.39.5
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH] f2fs: fix listxattr handling of corrupted xattr entries
@ 2026-06-18 20:01 ` Keshav Verma
0 siblings, 0 replies; 6+ messages in thread
From: Keshav Verma @ 2026-06-18 20:01 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, iganschel
Validate the xattr entry before reading its fields in f2fs_listxattr().
Return -EFSCORRUPTED when the entry is outside the valid xattr storage
area instead of returning a successful partial result.
Signed-off-by: Keshav Verma <iganschel@gmail.com>
---
fs/f2fs/xattr.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 610d5810074d..18f495db20d2 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -581,8 +581,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
size_t prefix_len;
size_t size;
- prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
-
if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
(void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
@@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
f2fs_handle_error(F2FS_I_SB(inode),
ERROR_CORRUPTED_XATTR);
- break;
+ error = -EFSCORRUPTED;
+ goto cleanup;
}
+ prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
+
if (!prefix)
continue;
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix listxattr handling of corrupted xattr entries
2026-06-18 20:01 ` Keshav Verma
@ 2026-06-22 1:23 ` Chao Yu
-1 siblings, 0 replies; 6+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2026-06-22 1:23 UTC (permalink / raw)
To: Keshav Verma, jaegeuk; +Cc: linux-kernel, linux-f2fs-devel
On 6/19/26 04:01, Keshav Verma wrote:
> Validate the xattr entry before reading its fields in f2fs_listxattr().
> Return -EFSCORRUPTED when the entry is outside the valid xattr storage
> area instead of returning a successful partial result.
>
Fixes line and Cc: stable@kernel.org
> Signed-off-by: Keshav Verma <iganschel@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
> ---
> fs/f2fs/xattr.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index 610d5810074d..18f495db20d2 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -581,8 +581,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
> size_t prefix_len;
> size_t size;
>
> - prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
> -
> if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
> (void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
> f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
> @@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
> set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
> f2fs_handle_error(F2FS_I_SB(inode),
> ERROR_CORRUPTED_XATTR);
> - break;
> + error = -EFSCORRUPTED;
> + goto cleanup;
> }
>
> + prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
> +
> if (!prefix)
> continue;
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] f2fs: fix listxattr handling of corrupted xattr entries
@ 2026-06-22 1:23 ` Chao Yu
0 siblings, 0 replies; 6+ messages in thread
From: Chao Yu @ 2026-06-22 1:23 UTC (permalink / raw)
To: Keshav Verma, jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel
On 6/19/26 04:01, Keshav Verma wrote:
> Validate the xattr entry before reading its fields in f2fs_listxattr().
> Return -EFSCORRUPTED when the entry is outside the valid xattr storage
> area instead of returning a successful partial result.
>
Fixes line and Cc: stable@kernel.org
> Signed-off-by: Keshav Verma <iganschel@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
> ---
> fs/f2fs/xattr.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index 610d5810074d..18f495db20d2 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -581,8 +581,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
> size_t prefix_len;
> size_t size;
>
> - prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
> -
> if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
> (void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
> f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
> @@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
> set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
> f2fs_handle_error(F2FS_I_SB(inode),
> ERROR_CORRUPTED_XATTR);
> - break;
> + error = -EFSCORRUPTED;
> + goto cleanup;
> }
>
> + prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
> +
> if (!prefix)
> continue;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] f2fs: fix listxattr handling of corrupted xattr entries
2026-06-18 20:01 ` Keshav Verma
@ 2026-06-22 15:14 ` Keshav Verma
-1 siblings, 0 replies; 6+ messages in thread
From: Keshav Verma @ 2026-06-22 15:14 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu
Cc: Randall Huang, linux-f2fs-devel, linux-kernel, Keshav Verma,
stable
Validate the xattr entry before reading its fields in f2fs_listxattr().
Return -EFSCORRUPTED when the entry is outside the valid xattr storage
area instead of returning a successful partial result.
Fixes: 688078e7f36c ("f2fs: fix to avoid memory leakage in f2fs_listxattr")
Cc: stable@kernel.org
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Keshav Verma <iganschel@gmail.com>
---
Changes in v2:
- Add Fixes tag.
- Add Reviewed-by tag.
- Add Cc: stable@kernel.org tag.
fs/f2fs/xattr.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 610d5810074d..18f495db20d2 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -581,8 +581,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
size_t prefix_len;
size_t size;
- prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
-
if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
(void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
@@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
f2fs_handle_error(F2FS_I_SB(inode),
ERROR_CORRUPTED_XATTR);
- break;
+ error = -EFSCORRUPTED;
+ goto cleanup;
}
+ prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
+
if (!prefix)
continue;
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* [f2fs-dev] [PATCH v2] f2fs: fix listxattr handling of corrupted xattr entries
@ 2026-06-22 15:14 ` Keshav Verma
0 siblings, 0 replies; 6+ messages in thread
From: Keshav Verma @ 2026-06-22 15:14 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: stable, linux-kernel, Keshav Verma, linux-f2fs-devel
Validate the xattr entry before reading its fields in f2fs_listxattr().
Return -EFSCORRUPTED when the entry is outside the valid xattr storage
area instead of returning a successful partial result.
Fixes: 688078e7f36c ("f2fs: fix to avoid memory leakage in f2fs_listxattr")
Cc: stable@kernel.org
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Keshav Verma <iganschel@gmail.com>
---
Changes in v2:
- Add Fixes tag.
- Add Reviewed-by tag.
- Add Cc: stable@kernel.org tag.
fs/f2fs/xattr.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 610d5810074d..18f495db20d2 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -581,8 +581,6 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
size_t prefix_len;
size_t size;
- prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
-
if ((void *)(entry) + sizeof(__u32) > last_base_addr ||
(void *)XATTR_NEXT_ENTRY(entry) > last_base_addr) {
f2fs_err(F2FS_I_SB(inode), "list inode (%llu) has corrupted xattr",
@@ -590,9 +588,12 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
f2fs_handle_error(F2FS_I_SB(inode),
ERROR_CORRUPTED_XATTR);
- break;
+ error = -EFSCORRUPTED;
+ goto cleanup;
}
+ prefix = f2fs_xattr_prefix(entry->e_name_index, dentry);
+
if (!prefix)
continue;
--
2.39.5
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-22 15:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 20:01 [f2fs-dev] [PATCH] f2fs: fix listxattr handling of corrupted xattr entries Keshav Verma
2026-06-18 20:01 ` Keshav Verma
2026-06-22 1:23 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2026-06-22 1:23 ` Chao Yu
2026-06-22 15:14 ` [PATCH v2] " Keshav Verma
2026-06-22 15:14 ` [f2fs-dev] " Keshav Verma
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.