mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiaolei Wang <wangxiaolei01@kaihong.com>
To: linusw@kernel.org, florian.fainelli@broadcom.com,
	rjui@broadcom.com, sbranden@broadcom.com,
	bcm-kernel-feedback-list@broadcom.com, daniel@dragonzap.com,
	wangxiaolei01@kaihong.com, iivanov@suse.de,
	andrea.porta@suse.com, phil@raspberrypi.com
Cc: linux-gpio@vger.kernel.org, linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/4] pinctrl: bcm: Two bounds fixes and a dt_free_map cleanup
Date: Fri, 13 Nov 2026 05:32:17 +0000	[thread overview]
Message-ID: <20261113053221.3131068-1-wangxiaolei01@kaihong.com> (raw)

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


             reply	other threads:[~2026-11-13  5:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  5:32 Xiaolei Wang [this message]
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

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=20261113053221.3131068-1-wangxiaolei01@kaihong.com \
    --to=wangxiaolei01@kaihong.com \
    --cc=andrea.porta@suse.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=daniel@dragonzap.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=iivanov@suse.de \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=phil@raspberrypi.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.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 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®