All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] pinctrl: bcm: Two bounds fixes and a dt_free_map cleanup
@ 2026-11-13  5:32 Xiaolei Wang
  2026-11-13  5:32 ` [PATCH v2 1/4] pinctrl: bcm: Fix off-by-one and out-of-bounds access in fsel_get() Xiaolei Wang
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Xiaolei Wang @ 2026-11-13  5:32 UTC (permalink / raw)
  To: linusw, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, daniel, wangxiaolei01, iivanov,
	andrea.porta, phil
  Cc: linux-gpio, linux-rpi-kernel, linux-arm-kernel, linux-kernel

This series fixes two out-of-bounds accesses in the BCM pin controllers
and drops two hand-written dt_free_map callbacks that duplicate
pinctrl_utils_free_map().

1/4 indexes funcs[] with the raw FSEL field, which is 1-based: 0 means
GPIO, 1..n_funcs map to funcs[0..n_funcs - 1]. Every debugfs readback is
therefore shifted by one slot, and n_funcs indexes past the array. Index
with fsel - 1 and map 0 and out-of-range values back to GPIO.

2/4 and 3/4 replace the per-driver dt_free_map with
pinconf_generic_dt_free_map(). Both drivers already select
GENERIC_PINCONF, and brcmstb already uses the generic dt_node_to_map, so
this is a mechanical cleanup with no behaviour change.

4/4 adds the missing AON SGPIO entries. The controller describes six
SGPIO pins at pin 32..37, but the function tables stop at pin 16 (C0)
and pin 14 (D0), so dumping the pin list indexes past the end. The
function data comes from the downstream rpi-6.12.y driver; C0 and D0
differ on the HDMI1 and PMIC I2C signals.

Testing: 1/4 was run on a Raspberry Pi 5 with KASAN; the "alt8" readback
no longer splats and field 0 reports GPIO. 4/4's out-of-bounds read was
reproduced on the same board. Its D0 entries are not runtime tested,
because the board loads the C0 table.

Changes in v2:
- 1/4: the commit message describes the bug in prose instead of pasting
  the fix, as Andrea suggested.
- 4/4 is new, for the SGPIO out-of-bounds read he reported.

Link to v1:
- https://patchwork.kernel.org/project/linux-arm-kernel/cover/20261106070628.1428691-1-wangxiaolei01@kaihong.com/


Xiaolei Wang (4):
  pinctrl: bcm: Fix off-by-one and out-of-bounds access in fsel_get()
  pinctrl: bcm: Use pinconf_generic_dt_free_map in bcm2835
  pinctrl: bcm: Use pinconf_generic_dt_free_map in brcmstb
  pinctrl: bcm: Add missing SGPIO entries to the BCM2712 AON tables

 drivers/pinctrl/bcm/pinctrl-bcm2835.c         | 16 ++----------
 drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c | 12 +++++++++
 drivers/pinctrl/bcm/pinctrl-brcmstb.c         | 26 ++++++++-----------
 3 files changed, 25 insertions(+), 29 deletions(-)

-- 
2.34.1


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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13  5:32 [PATCH v2 0/4] pinctrl: bcm: Two bounds fixes and a dt_free_map cleanup Xiaolei Wang
2026-11-13  5:32 ` [PATCH v2 1/4] pinctrl: bcm: Fix off-by-one and out-of-bounds access in fsel_get() Xiaolei Wang
2026-11-13 12:52   ` Andrea della Porta
2026-11-13  5:32 ` [PATCH v2 2/4] pinctrl: bcm: Use pinconf_generic_dt_free_map in bcm2835 Xiaolei Wang
2026-11-13  5:32 ` [PATCH v2 3/4] pinctrl: bcm: Use pinconf_generic_dt_free_map in brcmstb Xiaolei Wang
2026-11-13  5:32 ` [PATCH v2 4/4] pinctrl: bcm: Add missing SGPIO entries to the BCM2712 AON tables Xiaolei Wang
2026-11-13 12:53   ` Andrea della Porta
2026-11-13 13:12 ` [PATCH v2 0/4] pinctrl: bcm: Two bounds fixes and a dt_free_map cleanup Linus Walleij

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.