mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ata: reject invalid DT port numbers in AHCI drivers
@ 2026-11-10 15:03 shao.mingyin
  2026-11-10 15:03 ` [PATCH v2 1/2] ata: libahci_platform: reject invalid port numbers shao.mingyin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: shao.mingyin @ 2026-11-10 15:03 UTC (permalink / raw)
  To: dlemoal, cassel, linux-ide; +Cc: hansg, linux-kernel, stable

Both the shared AHCI platform support and the DWC glue use the "reg"
property of their port child nodes as a port number without checking
that it addresses one of the controller's ports.

Patch 1 is in the shared platform code.  ahci_platform_get_firmware()
uses "reg" as an index into hpriv->saved_port_cap[] while filling the
firmware-specific port capabilities, so a "reg" value at or above
hpriv->nports writes past that array.  Patch 2 is in the DWC glue.
ahci_dwc_init_dmacr() walks the same child nodes a second time and uses
"reg" both as an index into dpriv->dmacr[] and to compute the port MMIO
base, with the same out-of-range consequence.

Both loops now skip child nodes whose "reg" value is at or above
hpriv->nports, matching the check in ahci_platform_get_resources(),
which has already reported the invalid port number.  The two patches
are independent and can be applied in any order; each carries Fixes:
and Cc: stable.

Changes in v2:
 - Do not print a warning for an invalid port number: the resource loop
   has already reported it (Niklas Cassel).  The check is unchanged.
 - Send the two fixes, previously posted separately, as one series at
   Niklas's request.
 - 2/2 keeps Damien Le Moal's Reviewed-by from v1, since the only change
   is the dropped warning (confirmed by Niklas Cassel).

Link to v1 1/2: https://lore.kernel.org/all/20261029190111138tS0yRo0lL1zJZ_IutobE1@zte.com.cn/
Link to v1 2/2: https://lore.kernel.org/all/20261104221318841yKO89PGcSNeaV4KutBOUJ@zte.com.cn/
Review 1/2: https://lore.kernel.org/all/avHkMosHVOXCpVPD@ryzen/
Review 2/2: https://lore.kernel.org/all/avHknBRJnZPpAIke@ryzen/

Shao Mingyin (2):
  ata: libahci_platform: reject invalid port numbers
  ata: ahci_dwc: reject invalid DT port numbers

 drivers/ata/ahci_dwc.c         | 4 ++++
 drivers/ata/libahci_platform.c | 4 ++++
 2 files changed, 8 insertions(+)

---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-11  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 15:03 [PATCH v2 0/2] ata: reject invalid DT port numbers in AHCI drivers shao.mingyin
2026-11-10 15:03 ` [PATCH v2 1/2] ata: libahci_platform: reject invalid port numbers shao.mingyin
2026-11-11  8:59   ` Damien Le Moal
2026-11-10 15:03 ` [PATCH v2 2/2] ata: ahci_dwc: reject invalid DT " shao.mingyin
2026-11-10 20:08 ` [PATCH v2 0/2] ata: reject invalid DT port numbers in AHCI drivers Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®