| Message ID | 20260924222944.3683556-9-sandeen@redhat.com |
|---|---|
| State | New |
| Headers | show
Return-Path:
<SRS0=9BnH=HQ=vger.kernel.org=linux-ext4+bounces-19806-patchwork-incoming=ozlabs.org@ozlabs.org>
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@legolas.ozlabs.org
Authentication-Results: legolas.ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=mimecast20190719 header.b=I/mAihiN;
dkim=pass (2048-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=google header.b=GYBLjAQq;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org
(client-ip=150.107.74.76; helo=mail.ozlabs.org;
envelope-from=srs0=9bnh=hq=vger.kernel.org=linux-ext4+bounces-19806-patchwork-incoming=ozlabs.org@ozlabs.org;
receiver=patchwork.ozlabs.org)
Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4hrT7Z46yDz1y0M
for <incoming@patchwork.ozlabs.org>; Fri, 25 Sep 2026 08:30:50 +1000 (AEST)
Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])
by gandalf.ozlabs.org (Postfix) with ESMTP id 4hrT756PyNz4wJj
for <incoming@patchwork.ozlabs.org>; Fri, 25 Sep 2026 08:30:25 +1000 (AEST)
Received: by gandalf.ozlabs.org (Postfix)
id 4hrT756NT7z4wCp; Fri, 25 Sep 2026 08:30:25 +1000 (AEST)
Delivered-To: patchwork-incoming@ozlabs.org
Authentication-Results: gandalf.ozlabs.org;
arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org
ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1790289025; cv=pass;
b=b1QJYhSMFYcqRMlOJUeT/bytzefOmr9eFAhT8XFMHc8gde8WkF7oIWp+0slhwx4jXHiOhyIg9vebdOTGCAnCyW5OvYG2mXYrAPyMdayEDyzSJxnfnwczr5uUkmPAGYojmG+syEHUvfl8tMldSOIfJjXdDEPmte6xm0EKryjPpgxNNYdMCezXJ80lp9JI4OWFG5afsr2QWCdj17jLcqlJpC8mhIE/GzNo1w5RVJWJhw7loeQTKovkL0iRFyqmV1d7+fWUf1NrqoMbN5Xq7gsnwuAIs27FVUzFjjC3/NUTdBYn2zBjzZNEjlI/UG4Dk6M6Po491dwfa6HpI8z5XOsonQ==
ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707;
t=1790289025; c=relaxed/relaxed;
bh=/JPbKcTBOygIosoT5NJIzt0x/bV8oQDNYyTuHPzROr4=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version;
b=iWLUrbMbuhu/IM+fPnEBBneqa5TVDSiCJ2+uZv9ORJalXajV/aQD5YBbmDMsWp68suy4x1CYMV1C0zZ11pLDFqlUMyjiIu9BsR+fKLtND8NgenV+JwqO8wKOLD/yiAOp1LOKNmfOtOBt1n0xW03llCFATuaQWb2V2S+JL+7oR4dWE+mlAez5dd3J8rr/p3mbt97/EMoT6cK2cv+Cyk5/lIHFXBiBnyie4Ia28kFSFidIKA6+gWcCqz/wRXLLk+1XIRbMVS1iDsdIJ4meVI8W3fFDUMPLEn5z18vYMAYwQRabHrFomYY98MSakMpMbYI2NuE/hhi7z8nuBhsTWGGG9A==
ARC-Authentication-Results: i=2; gandalf.ozlabs.org;
dmarc=pass (p=quarantine dis=none) header.from=redhat.com;
dkim=pass (1024-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=mimecast20190719 header.b=I/mAihiN; dkim=pass (2048-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=google header.b=GYBLjAQq; dkim-atps=neutral;
spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;
envelope-from=linux-ext4+bounces-19806-patchwork-incoming=ozlabs.org@vger.kernel.org;
receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org
Authentication-Results: gandalf.ozlabs.org;
dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: gandalf.ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=mimecast20190719 header.b=I/mAihiN;
dkim=pass (2048-bit key;
unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256
header.s=google header.b=GYBLjAQq;
dkim-atps=neutral
Authentication-Results: gandalf.ozlabs.org;
spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org
(client-ip=172.234.253.10; helo=sea.lore.kernel.org;
envelope-from=linux-ext4+bounces-19806-patchwork-incoming=ozlabs.org@vger.kernel.org;
receiver=ozlabs.org)
Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519)
(No client certificate requested)
by gandalf.ozlabs.org (Postfix) with ESMTPS id 4hrT6z6nr3z4wJj
for <patchwork-incoming@ozlabs.org>; Fri, 25 Sep 2026 08:30:19 +1000 (AEST)
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org
[100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 225EA68A80
for <patchwork-incoming@ozlabs.org>; Thu, 24 Sep 2026 22:30:02 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A8DB441442F;
Thu, 24 Sep 2026 22:30:00 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com
header.b="I/mAihiN";
dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com
header.b="GYBLjAQq"
X-Original-To: linux-ext4@vger.kernel.org
Received: from us-smtp-delivery-124.mimecast.com
(us-smtp-delivery-124.mimecast.com [170.10.129.124])
(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 D1F0640A926
for <linux-ext4@vger.kernel.org>; Thu, 24 Sep 2026 22:29:58 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=none smtp.client-ip=170.10.129.124
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1790289000; cv=none;
b=bGEMCgULIbW6djiy5F3Ao0VtzMWAKAzI1V6MTkGWc7Kg6aYcvVwyv02u47lnKugWBv10r/9Q+Za329Dz1tdAe2qgwW6b8mqF0/WDVPr3KyRPVtHWdXqx+NSXm4dZ3232Ci7YPg5Gpyv5++04gmZqaMxSWr9Y2Pp0aO09rRH+WSk=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1790289000; c=relaxed/simple;
bh=IQZ5Qz3B02DHilP8/lrHynVk/gWCWnZRlP5K2MsqtuI=;
h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
MIME-Version;
b=DVm58Db3SCQvcNnhzCTOkwe71wuW49+S7QcGtRLNn0FJeedSrBD9pj15DANaUeAjDpbDAm6OD1GgYIlC01U7DU0FqQT0726Jg9d3bAil5Z+qW7Oo+c9tJeaQJqHleTSZsqT57JjPJ9h32QxzosFs6sf+fnYe3OIipdHQREZucC8=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass (p=quarantine dis=none) header.from=redhat.com;
spf=pass smtp.mailfrom=redhat.com;
dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com
header.b=I/mAihiN;
dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com
header.b=GYBLjAQq; arc=none smtp.client-ip=170.10.129.124
Authentication-Results: smtp.subspace.kernel.org;
dmarc=pass (p=quarantine dis=none) header.from=redhat.com
Authentication-Results: smtp.subspace.kernel.org;
spf=pass smtp.mailfrom=redhat.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
s=mimecast20190719; t=1790288997;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=/JPbKcTBOygIosoT5NJIzt0x/bV8oQDNYyTuHPzROr4=;
b=I/mAihiNIPVUz6mZpa44Za2iOAKyfStWhOCj9ZDiBv5/HcPJoDfqFMwQw6ksGYYTXCmVud
W2wghTMRVVjCglnk0ctdQdeF/+VjOcQdigEOqr9SrtoWa0DCzBGg7Nstpf63jDuevvE7wH
9OeG+h9vMyegBQZ97uYTbo0Uqw9bk6c=
Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com
[209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS
(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
us-mta-269-SYxe64uDMUajuuYBmxTOQw-1; Thu, 24 Sep 2026 18:29:56 -0400
X-MC-Unique: SYxe64uDMUajuuYBmxTOQw-1
X-Mimecast-MFC-AGG-ID: SYxe64uDMUajuuYBmxTOQw_1790288996
Received: by mail-qk1-f198.google.com with SMTP id
af79cd13be357-93ae8e7e546so59587185a.1
for <linux-ext4@vger.kernel.org>;
Thu, 24 Sep 2026 15:29:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=redhat.com; s=google; t=1790288996; x=1790893796;
darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=/JPbKcTBOygIosoT5NJIzt0x/bV8oQDNYyTuHPzROr4=;
b=GYBLjAQq+d5u6do1eLJ3ESihX6qUNACW55NhFnZjDJvxq60VRFeoGnsUY62ynSIEHi
sOHG+UdUNqinpVVBIbVOgd3gqeAOyQ7MK4VlCOTqVh6+r9W1m0JZ1NK2RD0Q00eQx8XI
NSazJM17TYDR/c1GAFuMplU8OAcZnHlvKSZmuLstSjZiyAuAALVKHnE2wkWZBLokNg2/
glnsaZhWQiaPB62cOsVvoyowMUYLur16qytHUAWOtmgInxjfysZ89X2bm0RJQIbH0xEm
x42vPHs5CYjypTUKCnzLFqK5dc64+nw+EvUXIg/eB+v3f99KYC5Bc/ioOmVWhC3+RBCj
3wWA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1790288996; x=1790893796;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=/JPbKcTBOygIosoT5NJIzt0x/bV8oQDNYyTuHPzROr4=;
b=xlE2ggeEKmeKpsENEMOoYyk9SHG05l1NppFJeRTv0d4tF5nbsjwKs4vXe7/SRj0G+U
KoZhQ6AA7rYAESXd8vl3Hr8HO6ufD0G/JaGErxSSezF9zXRJmdqghKXQAakzrxg+yWmJ
NDn664/Vbjgcw0fzOAoiX8cBNtCvGFZgouCeHZ+KU8/TNRiOeVBmLtpNxg86q+SgsCz+
kaVrnUEtZFMBUeaGFRYBAUzfs2t7QmaQ2ceuGMsB3e7LVwN9JgkZNmXha9tvKcpkDaKm
nlIxWXFUvA08zEOxQB0Wtwvb8Qwsl0H0peeL9floXB6iqC7q29Ts9T/eg27TANbmMC02
ueeQ==
X-Gm-Message-State: AFuF++lsO4akyQghQonCZPXNUEqPgu6IZXQRFqEQNUaL6Utj1+jsczQR
49x63L4B1d3LqtRAXUblhPIrcdcutALDc9AolGAXAwe47FER76dTptQI5RdDoKLiiVw5AjC2u/S
mrzvk/tEoOJo4S22OXoaq8f7JmsPVAtT+lVgB9pY0jtsgc37dLdU29Ni/elvASYUXFN4zfUxTWQ
3sW+DlRCiFDwaRNmRhCkcb6Hk+WxhaSET8aC7GtOjtZ45ABDfj
X-Gm-Gg: AYBFou3ipVtvd1UZrKIxr1DmTFO+vD+i9/z5M0OIIDaQa/u/BDb1XUReUJ9WPocn3Es
HeBHtOPAB+h6kUCXorIZpLEC4fNCeYCQeY2vra3UwOO6HPb/eDE6StYoMVXD4e682soOKuDr2ol
6xtQZNqDbqVbWhfYa8KdaVqz9LTG7nfJMPfcsVPhc2889ad9/6MsmZFJG+vc9RyJysvVVWIU6td
51Uri4+Sh+V+Tl2t4kbe4qncqEiRcWxBOnJCV+50SGEcaxotpUjsSaG8toZzI0l79DHHhdjVmwa
a7miS/vvCzSSEgYW5i70fKY1a3g4x+FdD+7CIo7aH5dzEdtlZGt0P2b5KI44i6HIvN4hvP8yrV5
lskeDx4+4Kp+S2qg1OJKzvejTjkScZT0FhzQI5w==
X-Received: by 2002:a05:620a:414a:b0:939:9b1c:ea4c with SMTP id
af79cd13be357-93c43bc93b2mr151443385a.28.1790288996044;
Thu, 24 Sep 2026 15:29:56 -0700 (PDT)
X-Received: by 2002:a05:620a:414a:b0:939:9b1c:ea4c with SMTP id
af79cd13be357-93c43bc93b2mr151440685a.28.1790288995533;
Thu, 24 Sep 2026 15:29:55 -0700 (PDT)
Received: from big24.sandeen.net (97-116-156-223.mpls.qwest.net.
[97.116.156.223])
by smtp.gmail.com with ESMTPSA id
af79cd13be357-93c44972febsm37216985a.39.2026.09.24.15.29.54
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 24 Sep 2026 15:29:55 -0700 (PDT)
From: Eric Sandeen <sandeen@redhat.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu,
sandeen@redhat.com,
agruenba@redhat.com
Subject: [PATCH 8/8] libext2fs: fix ea loop in ext2fs_xattr_inode_max_size
Date: Thu, 24 Sep 2026 17:23:42 -0500
Message-ID: <20260924222944.3683556-9-sandeen@redhat.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260924222944.3683556-1-sandeen@redhat.com>
References: <20260924222944.3683556-1-sandeen@redhat.com>
Precedence: bulk
X-Mailing-List: linux-ext4@vger.kernel.org
List-Id: <linux-ext4.vger.kernel.org>
List-Subscribe: <mailto:linux-ext4+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-ext4+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,HEADER_FROM_DIFFERENT_DOMAINS,
MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled
version=4.0.1
X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org
|
| Series |
e2fsprogs: fix extended attribute iteration loop bounds checking
|
expand
|
diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index 6f6d2f4f..f2ac8911 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -1211,8 +1211,8 @@ errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino, struct ext2_ext_attr_entry *entry; struct ext2_inode_large *inode; __u32 ea_inode_magic; - unsigned int minoff; - char *start; + unsigned int minoff, remain; + char *start, *end; size_t i; errcode_t err; @@ -1241,14 +1241,25 @@ errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino, inode->i_extra_isize, sizeof(__u32)); if (ea_inode_magic == EXT2_EXT_ATTR_MAGIC) { /* has xattrs. calculate the size */ - start= ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE + + start = ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE + inode->i_extra_isize + sizeof(__u32); + end = (char *)inode + EXT2_INODE_SIZE(fs->super); + /* take finish entry 0UL into account */ + remain = end - (char *)start - sizeof(__u32); entry = (struct ext2_ext_attr_entry *) start; while (!EXT2_EXT_IS_LAST_ENTRY(entry)) { + /* end->e_name_len is within the first four bytes */ + if (EXT2_EXT_ATTR_LEN(entry->e_name_len) > remain) + return EXT2_ET_INLINE_DATA_NO_SPACE; + remain -= EXT2_EXT_ATTR_LEN(entry->e_name_len); + if (!entry->e_value_inum && entry->e_value_size) { unsigned int offs = entry->e_value_offs; if (offs < minoff) minoff = offs; + if (EXT2_EXT_ATTR_SIZE(entry->e_value_size) > remain) + return EXT2_ET_INLINE_DATA_NO_SPACE; + remain -= EXT2_EXT_ATTR_SIZE(entry->e_value_size); } entry = EXT2_EXT_ATTR_NEXT(entry); }