]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
orangefs: validate getxattr response length
authorHyungJung Joo <jhj140711@gmail.com>
Fri, 13 Mar 2026 06:34:44 +0000 (15:34 +0900)
committerMike Marshall <hubcap@omnibond.com>
Tue, 7 Apr 2026 15:28:19 +0000 (11:28 -0400)
orangefs_inode_getxattr() trusts the userspace-client-controlled
downcall.resp.getxattr.val_sz and uses it as a memcpy() length
both for the temporary user buffer and the cached xattr buffer.
Reject malformed negative or oversized lengths before copying
response bytes.

Reported-by: Hyungjung Joo <jhj140711@gmail.com>
Signed-off-by: HyungJung Joo <jhj140711@gmail.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/xattr.c

index 1b372189cd10b653258d147c9d2c5b6cedca49bf..b6d116302de4eefc06e1d8040f2b6171ee061dba 100644 (file)
@@ -188,6 +188,10 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name,
         * Length returned includes null terminator.
         */
        length = new_op->downcall.resp.getxattr.val_sz;
+       if (length < 0 || length > ORANGEFS_MAX_XATTR_VALUELEN) {
+               ret = -EIO;
+               goto out_release_op;
+       }
 
        /*
         * Just return the length of the queried attribute.