Skip to content

Commit 092e0d0

Browse files
Papya-jhubcapsc
authored andcommitted
orangefs: validate getxattr response length
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>
1 parent 415e507 commit 092e0d0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/orangefs/xattr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name,
188188
* Length returned includes null terminator.
189189
*/
190190
length = new_op->downcall.resp.getxattr.val_sz;
191+
if (length < 0 || length > ORANGEFS_MAX_XATTR_VALUELEN) {
192+
ret = -EIO;
193+
goto out_release_op;
194+
}
191195

192196
/*
193197
* Just return the length of the queried attribute.

0 commit comments

Comments
 (0)