From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AF75B328B52; Mon, 27 Oct 2025 18:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591397; cv=none; b=WC8DOKuXKC+7xPAx2qmMZHRiVjwNG6MxhnLM+RGyeDHI5BsKIRluDgqMIEISILWQupgsSOYaFSw084WGJGodzHmjVba7xE6Tspj8Fmz4rtMBE4lByoJYEIlFCVShXS/W1/t6GK1WQiRYQNLCYLdAqB/KuuzECX6FZugvdxMAxB4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591397; c=relaxed/simple; bh=k0PmHIBMZF470MWEFychvs4CiRARy/H7VOWV7VWooHY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sg/gf2mkd41zHtgnrHz7p5IvNUZCqtuYXo1sZtydpBBd7YJacqvz6Oyky2oJa+KjupeeWhhgk1bFkEG8XOLoNIe9wkIORYJNBJo3G8OIV9Sr40/byA0DQq5m6om3uWrAxcEtsV9SYkzYPBXu4asj0T5776+udzVUJbWBxKRkwZA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KAEbS19J; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KAEbS19J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36AACC4CEF1; Mon, 27 Oct 2025 18:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761591397; bh=k0PmHIBMZF470MWEFychvs4CiRARy/H7VOWV7VWooHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAEbS19JFWOdG7jU2M0eZrweVoXSiaQUNwBdbvXjKVPJYWQJK8XfzCGJgOfaNZKsB V5h+AUcDvtvwmHGTKJYOfrjqyKPE0m+8ctt0bP73XlOXQIyAFp6hCJkt2nvHGqm5+6 m2KV26cYsEBAnd+UC7M4nLhmd8oGAlrEf9DXPmVE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+8901c4560b7ab5c2f9df@syzkaller.appspotmail.com, Jan Kara , Gianfranco Trad , Jan Kara , Sasha Levin Subject: [PATCH 5.10 181/332] udf: fix uninit-value use in udf_get_fileshortad Date: Mon, 27 Oct 2025 19:33:54 +0100 Message-ID: <20251027183529.439020954@linuxfoundation.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251027183524.611456697@linuxfoundation.org> References: <20251027183524.611456697@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: Gianfranco Trad [ Upstream commit 264db9d666ad9a35075cc9ed9ec09d021580fbb1 ] Check for overflow when computing alen in udf_current_aext to mitigate later uninit-value use in udf_get_fileshortad KMSAN bug[1]. After applying the patch reproducer did not trigger any issue[2]. [1] https://syzkaller.appspot.com/bug?extid=8901c4560b7ab5c2f9df [2] https://syzkaller.appspot.com/x/log.txt?x=10242227980000 Reported-by: syzbot+8901c4560b7ab5c2f9df@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=8901c4560b7ab5c2f9df Tested-by: syzbot+8901c4560b7ab5c2f9df@syzkaller.appspotmail.com Suggested-by: Jan Kara Signed-off-by: Gianfranco Trad Signed-off-by: Jan Kara Link: https://patch.msgid.link/20240925074613.8475-3-gianf.trad@gmail.com Stable-dep-of: 3bd5e45c2ce3 ("fs: udf: fix OOB read in lengthAllocDescs handling") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/udf/inode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -2190,12 +2190,15 @@ int8_t udf_current_aext(struct inode *in alen = udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc; } else { + struct allocExtDesc *header = + (struct allocExtDesc *)epos->bh->b_data; + if (!epos->offset) epos->offset = sizeof(struct allocExtDesc); ptr = epos->bh->b_data + epos->offset; - alen = sizeof(struct allocExtDesc) + - le32_to_cpu(((struct allocExtDesc *)epos->bh->b_data)-> - lengthAllocDescs); + if (check_add_overflow(sizeof(struct allocExtDesc), + le32_to_cpu(header->lengthAllocDescs), &alen)) + return -1; } switch (iinfo->i_alloc_type) {