From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C9982D7DF1; Tue, 21 Jul 2026 22:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674574; cv=none; b=ovm4s+wkPxWZsFtdgh7ROx/WYMC1JT+zWxawtBEhZxms/3O9fOJn8mP4BVWQ4ocTd1jperoTTlIQnurxqwsu3ngOgGZAzmwUhuRGC2bdgmFiZHVRIYvb8aKX/o5Npi4TS7ZxRYPUmN/ViH8K9QCzSjaX17CHIupvh7Mht+wVRho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674574; c=relaxed/simple; bh=/IGrye15/YdCBQ1VYcfF8YP53C9WBd4622uVo7FrhBc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRr/7gFYlpqtga4YEFFcYl9P+mU6BpQrOB3B+QaaOyvvYVV6A9U1cX2qjEWHNnRuXLZqRCe3EhHZx4WckLXkHcoG/497U46oNesXQKloljU2dyoDkpupRyk+bjOAMPDpd5JxFZiPg7Udb9JL6jAyA/iF5SVNFFFemjhnfqqlxYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0CS74WXg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0CS74WXg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 712421F000E9; Tue, 21 Jul 2026 22:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674572; bh=cQ4XmnTus2sW+wt78x4YcuuWLf8/2IBfwhdnZ7M4MrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0CS74WXgfFhKaBhSx2TGHSAzm4oYorllBA+TyTOJi+1mBFar9cdELk+MOKVk6okeS ykZ7aH2uO5C6TAUZeYHbDZMbWWbrm3DOkDADcnW9xqcWaX2hTkRu8kKPA/rnmekX/u 1wcqqCwDkj7SMmw+Gt5UdRWBnLLh6E1fMGMA/pkU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , "Christian Brauner (Amutable)" Subject: [PATCH 5.10 549/699] orangefs: keep the readdir entry size 64-bit in fill_from_part() Date: Tue, 21 Jul 2026 17:25:08 +0200 Message-ID: <20260721152408.086055558@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas commit 18227a6bc98bd0ba96ed3ce9d5b28776a5a28dfc upstream. fill_from_part() computes the size of a directory entry in size_t but stores it in a __u32. An entry length near U32_MAX wraps it to a small value, bypasses the bounds check, and is then used to index the entry, reading far past the directory part -- an out-of-bounds read that oopses the kernel. Compute the size as a u64 so it cannot truncate; the bounds check then rejects the entry. The trailer is supplied by the userspace client. Fixes: 480e3e532e31 ("orangefs: support very large directories") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas Link: https://patch.msgid.link/20260619-b4-disp-50d2bd59-v1-1-ce332969b4a2@proton.me Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Greg Kroah-Hartman --- fs/orangefs/dir.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/orangefs/dir.c +++ b/fs/orangefs/dir.c @@ -191,7 +191,8 @@ static int fill_from_part(struct orangef { const int offset = sizeof(struct orangefs_readdir_response_s); struct orangefs_khandle *khandle; - __u32 *len, padlen; + __u32 *len; + u64 padlen; loff_t i; char *s; i = ctx->pos & ~PART_MASK; @@ -215,8 +216,8 @@ static int fill_from_part(struct orangef * len is the size of the string itself. padlen is the * total size of the encoded string. */ - padlen = (sizeof *len + *len + 1) + - (8 - (sizeof *len + *len + 1)%8)%8; + padlen = (u64)sizeof *len + *len + 1; + padlen += (8 - padlen % 8) % 8; if (part->len < i + padlen + sizeof *khandle) goto next; s = (void *)part + offset + i + sizeof *len;