mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] jfs: allow xattr values of USHRT_MAX bytes
@ 2026-11-02 21:42 Hungyu Lin
  0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-11-02 21:42 UTC (permalink / raw)
  To: Dave Kleikamp; +Cc: Jie Liu, jfs-discussion, linux-kernel, Hungyu Lin

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@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-02 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 21:42 [PATCH] jfs: allow xattr values of USHRT_MAX bytes Hungyu Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®