PT-2026-163045
CVE-2026-139004
·
Publicado
2026-11-30
·
Atualizado
2026-11-30
Descrição por
Pontuação
N/A
Não disponívelNão há classificações de severidade ou métricas disponíveis. Quando houver, atualizaremos as informações correspondentes na página.
In the Linux kernel, the following vulnerability has been resolved:
spi: spi-qpic-snand: publish the ECC context to snandc->qspi
qcom spi ooblayout ecc() and qcom spi ooblayout free() read the ECC
configuration through snandc->qspi->ecc. qcom spi probe() points it at a
zeroed scratch struct and only qcom spi ecc prepare io req pipelined(),
which runs on page I/O, ever updates it. qcom spi ecc init ctx pipelined()
installs the ooblayout but does not publish the context it just
allocated, and qcom spi ecc cleanup ctx pipelined() frees that context
without clearing the pointer.
spinand init() calls mtd ooblayout count freebytes() right after the ECC
context is created and before any page I/O, so the ooblayout always runs
against a pointer that does not describe the current context:
-
On a first probe it reads the zeroed struct from qcom spi probe(), so steps, bytes and bbm size are 0. The count then returns 0 rather than an error, so the probe continues with mtd->oobavail set to 0.
-
On a probe retry it reads the ecc cfg the previous attempt freed.
A retry is easy to hit. On IPQ5018 with the qcom,smem-part parser the
partition parse returns -EPROBE DEFER until SMEM has probed, so the
first spi-nand probe defers. It defers inside
mtd device parse register(), after mtd otp nvmem add() has already read
the factory OTP - that read goes through prepare io req and leaves
snandc->qspi->ecc pointing at the context that spinand cleanup() then
frees. The second probe allocates a new context, never publishes it, and
computes the OOB layout from the freed one. Once the slab has been
reused, qecc->steps holds garbage and
oobregion->length = qecc->steps * 4;
goes negative. qcom spi ooblayout free() only reports -ERANGE for
section 1 and later, so mtd ooblayout count bytes() sums the regions and
returns that negative length as the byte count. The -512 below is
steps * 4 with steps == -128. It is a byte count that happens to
collide with -ERESTARTSYS, not an error the driver returned.
spinand init() takes it as an error, and because it is not
-EPROBE DEFER the driver core never retries and the NAND never appears:
spi-nand spi0.0: ESMT SPI NAND was found.
spi-nand spi0.0: probe with driver spi-nand failed with error -512
UBI error: cannot open mtd rootfs, error -2
Waiting for root device /dev/ubiblock0 1...
On a Mercusys MR80X (IPQ5018, ESMT F50D1G41LB) about half of the boots
failed to mount the rootfs, the outcome depending on whether the freed
memory had been overwritten yet.
Publish the context when it is created and clear the pointer when it is
destroyed. Clearing leaves snandc->qspi->ecc NULL after cleanup, which
is safe: the mtd is unregistered before cleanup ctx runs, so no
ooblayout callback can follow.
Encontrou algum problema na descrição? Tem algo a acrescentar? Fique à vontade para nos escrever 👾