Skip to contentSkip to conversation

jfs: allow xattr values of USHRT_MAX bytes

PATCH New Hungyu Lin 1 participant 1 message Nov 2 JFS filesystem

lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH 1/1 jfs: allow xattr values of USHRT_MAX bytes

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")
---
 fs/jfs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/xattr.c +1 -1
index dcc4a69d44fe..44c1348fece8 100644
@@ -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;
 		}
Signature · 1 line
2.43.0