All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Scott Wood <scottwood@freescale.com>,
	Stephen Chivers <schivers@mandarin.aust.csc.com>
Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, Thorsten Blum <blum@kernel.org>
Subject: [PATCH 2/6] powerpc/embedded6xx: Validate bus-range length in mvme5100_add_bridge()
Date: Mon,  2 Nov 2026 16:30:00 +0100	[thread overview]
Message-ID: <20261102152957.300019-10-blum@kernel.org> (raw)
In-Reply-To: <20261102152957.300019-8-blum@kernel.org>

mvme5100_add_bridge() reads two cells from the bus-range property
without checking its length, and a truncated property can cause an
out-of-bounds read.

Check the length before reading the bus numbers.

Fixes: be2019816e4d ("powerpc/embedded6xx: Add support for Motorola/Emerson MVME5100")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/powerpc/platforms/embedded6xx/mvme5100.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/embedded6xx/mvme5100.c b/arch/powerpc/platforms/embedded6xx/mvme5100.c
index 5ca41972ef22..6a88abac047a 100644
--- a/arch/powerpc/platforms/embedded6xx/mvme5100.c
+++ b/arch/powerpc/platforms/embedded6xx/mvme5100.c
@@ -114,6 +114,10 @@ static int __init mvme5100_add_bridge(struct device_node *dev)
 	pr_info("Adding PCI host bridge %pOF\n", dev);
 
 	bus_range = of_get_property(dev, "bus-range", &len);
+	if (bus_range && len < 2 * sizeof(*bus_range)) {
+		pr_err("bus-range property is too short\n");
+		return -EINVAL;
+	}
 
 	hose = pcibios_alloc_controller(dev);
 	if (hose == NULL)

  parent reply	other threads:[~2026-11-02 15:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 15:29 [PATCH 0/6] powerpc: MVME5100 fixes and cleanups Thorsten Blum
2026-11-02 15:29 ` [PATCH 1/6] powerpc: dts: mvme5100: Drop #interrupt-cells from ISA node Thorsten Blum
2026-11-02 15:30 ` Thorsten Blum [this message]
2026-11-02 15:30 ` [PATCH 3/6] powerpc/embedded6xx: Fix logged function name in mvme5100_add_bridge() Thorsten Blum
2026-11-02 15:30 ` [PATCH 4/6] powerpc/embedded6xx: Use __func__ in mvme5100_pic_init() Thorsten Blum
2026-11-02 15:30 ` [PATCH 5/6] powerpc/embedded6xx: Mark pci_membase as __initdata Thorsten Blum
2026-11-02 15:30 ` [PATCH 6/6] powerpc/embedded6xx: Drop redundant initializations Thorsten Blum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102152957.300019-10-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=robh@kernel.org \
    --cc=schivers@mandarin.aust.csc.com \
    --cc=scottwood@freescale.com \
    --cc=sshegde@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.