public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 9p: cap xattr max size to XATTR_SIZE_MAX
@ 2024-03-04 12:42 Dominique Martinet
  2024-03-04 13:35 ` Christian Schoenebeck
  0 siblings, 1 reply; 7+ messages in thread
From: Dominique Martinet @ 2024-03-04 12:42 UTC (permalink / raw)
  To: Eric Van Hensbergen, Latchesar Ionkov, Christian Schoenebeck
  Cc: v9fs, linux-kernel, Christian Brauner, xingwei lee, sam sun,
	Dominique Martinet

We probably shouldn't ever get an xattr bigger than that, and the current check
of SSIZE_MAX is a bit too large.

Cc: Christian Brauner <brauner@kernel.org>
Cc: xingwei lee <xrivendell7@gmail.com>
Cc: sam sun <samsun1006219@gmail.com
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
 fs/9p/xattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index 8604e3377ee7..97f60b73bf16 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -37,8 +37,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
 	if (attr_size > buffer_size) {
 		if (buffer_size)
 			retval = -ERANGE;
-		else if (attr_size > SSIZE_MAX)
-			retval = -EOVERFLOW;
+		else if (attr_size > XATTR_SIZE_MAX)
+			retval = -E2BIG;
 		else /* request to get the attr_size */
 			retval = attr_size;
 	} else {

---
base-commit: be3193e58ec210b2a72fb1134c2a0695088a911d
change-id: 20240304-xattr_maxsize-edf98c1a8c19

Best regards,
-- 
Dominique Martinet | Asmadeus


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-22 20:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-04 12:42 [PATCH] 9p: cap xattr max size to XATTR_SIZE_MAX Dominique Martinet
2024-03-04 13:35 ` Christian Schoenebeck
2024-03-04 14:19   ` Christian Brauner
2024-03-04 14:35     ` Seth Forshee
2024-03-04 14:44       ` Seth Forshee
2024-09-01  7:16   ` Fedor Pchelkin
2024-09-22 20:26     ` Dominique Martinet

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