mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hungyu Lin <dennylin0707@gmail.com>
To: Dave Kleikamp <shaggy@kernel.org>
Cc: Jie Liu <jeff.liu@oracle.com>,
	jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH] jfs: allow xattr values of USHRT_MAX bytes
Date: Mon,  2 Nov 2026 21:42:01 +0000	[thread overview]
Message-ID: <20261102214201.55330-1-dennylin0707@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-02 21:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102214201.55330-1-dennylin0707@gmail.com \
    --to=dennylin0707@gmail.com \
    --cc=jeff.liu@oracle.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaggy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®