[PATCH] jfs: allow xattr values of USHRT_MAX bytes

From: Hungyu Lin

Date: Mon Nov 02 2026 - 17:55:21 EST


The on-disk EA value length is __le16, which can represent 65535 bytes.
However, __jfs_setxattr() rejects values whose length is equal to
USHRT_MAX as well as values that exceed it. This prevents setfattr from
storing a 65535-byte value and cp --preserve=xattr from preserving such
an attribute when copying a file to JFS.

Reject only lengths greater than USHRT_MAX. A 65536-byte value still
returns E2BIG rather than overflowing the on-disk length field.

Fixes: 0439e091e3b1 ("jfs: fix xattr value size overflow in __jfs_setxattr")
Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
---
fs/jfs/xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index dcc4a69d44fe..44c1348fece8 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -755,7 +755,7 @@ int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name,
* return -E2BIG in this case, which is consistent with the
* VFS setxattr interface.
*/
- if (value_len >= USHRT_MAX) {
+ if (value_len > USHRT_MAX) {
rc = -E2BIG;
goto release;
}
--
2.43.0