From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 0DC003A1D0C for ; Mon, 6 Jul 2026 14:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783349228; cv=none; b=ZZ05gXOx//TN43a9/6muEPo65u3Fz7wlx9GZmmqh4PoHts835IZDGIP3jj4EtAV4gK1B5xn8vApBl92bJsRp62wo/wtYsAjFzAWtQ++aVmICeS8t2jn0pc/jD8MSkaCvn1lOtGUhVZ56505GS2x0WQ+xHZu2zzYqSLLHvmkeSeA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783349228; c=relaxed/simple; bh=P/Hl+OBEfaz8g8NpQn3WmEYW359iotcUYJ2AqubcXrE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=HbBl7uy11TIZWLfjBQpcK5h85RIlEllNHo0+CJSpVqq1z6cdosbTsMj4ohSpw48o7Kyg4pNF/UNhQzbUhDYHVked/w6dnZwuFlVQnOVS9dSJxWUIQJ6yQgx5pOj2NC72/0wVWw/hjjwDrTm2cxVU1NWJrIB92AcwD667Dsh8kio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=UOiiabNc; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UOiiabNc" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 6C9BDC79AB1; Mon, 6 Jul 2026 14:47:18 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 41FEE601A2; Mon, 6 Jul 2026 14:47:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9BB7911BBA5C8; Mon, 6 Jul 2026 16:47:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1783349224; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=P/Hl+OBEfaz8g8NpQn3WmEYW359iotcUYJ2AqubcXrE=; b=UOiiabNceAba+QHR7BK91h9WhY4TzqkGRH1IoE7RPJFLPYChgEZyPh+7TaChUFATF+QgDV 8KVLmgAT22X5vLxGwL2aicV1EkQRKWFg2TlsgdCb1LPSr7oqgSmNtwMY98wbeZ40fkieMp ypaLV8XgwW8mCtbukS912hf1UYeCJggefbOzfYH4edqR+VkmCzWkZb3XY6HcdgUZ9oeCz0 tcgaJeJD0GreV3M5jgvq1kSwvU6qz+R3nxLLv/zXhhNnSVrterDtNfmN1FIVe0Z1MFqkXb 86VAi4NeVk904PYLlURzHJwq4wP5vUJJytgAFqAAFbjO4C0UAZfd1bQd3ZlrMA== From: Miquel Raynal To: Pengpeng Hou Cc: Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: afs: validate v2 image info bounds In-Reply-To: <20260706094059.82323-1-pengpeng@iscas.ac.cn> (Pengpeng Hou's message of "Mon, 6 Jul 2026 17:40:59 +0800") References: <20260706094059.82323-1-pengpeng@iscas.ac.cn> User-Agent: mu4e 1.12.7; emacs 30.2 Date: Mon, 06 Jul 2026 16:47:01 +0200 Message-ID: <87se5wjhui.fsf@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 On 06/07/2026 at 17:40:59 +08, Pengpeng Hou wrote: > The AFS v2 parser uses footer[8] to locate the image information block > inside the current erase block, then uses the image information > region_count to walk entries from a fixed local array. The footer offset > and region count come from flash contents and were not checked against the > erase block or the local image-info array before use. > > Reject v2 entries whose image information offset would underflow the erase > block calculation, and reject region counts that cannot fit in the local > image-info array before walking region entries. > > Signed-off-by: Pengpeng Hou I'll let you guess what is missing in this contribution? Thanks, Miqu=C3=A8l