From: Wang Xiaolei <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 0/3] pinctrl: bcm: Fix fsel_get() and use generic dt_free_map
Date: Fri, 6 Nov 2026 07:06:25 +0000 [thread overview]
Message-ID: <20261106070628.1428691-1-wangxiaolei01@kaihong.com> (raw)
This series contains one fix and two cleanups for the Broadcom pin
controllers.
Patch 1 fixes an off-by-one and out-of-bounds read in the STB pin
controller driver that was added in v6.18. The FSEL register field is
a 1-based function number -- 0 means GPIO, 1..n_funcs select
funcs[0..n_funcs - 1] -- but brcmstb_pinctrl_fsel_get() uses the raw
field value as a 0-based index into funcs[]. Every readback is
therefore shifted by one entry, and the value 8, which
brcmstb_pinctrl_fsel_set() accepts as the eighth alternate function,
reads funcs[8] and trips KASAN when the pin state is printed through
debugfs.
Patches 2 and 3 replace hand-written dt_free_map callbacks with
pinconf_generic_dt_free_map(). Both drivers already call
pinconf_generic_dt_node_to_map_*() for dt_node_to_map and already
select GENERIC_PINCONF, so the generic helper is the matching
counterpart, and the open-coded free loop just duplicates what
pinctrl_utils_free_map() already does. No functional change is
intended for the map types the existing device trees use.
Patch 1 was tested on a Raspberry Pi 5 with KASAN enabled. Before the
change, writing "gpio45 alt8" to pinmux-select and then reading pins
triggers a global-out-of-bounds splat in brcmstb_pctl_pin_dbg_show();
after the change the same sequence reports "function spi_m" without
a warning, and a register field value of 0 reports "gpio".
The series is based on v7.4-rc1 and has no inter-patch dependencies.
Wang Xiaolei (3):
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
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 16 ++--------------
drivers/pinctrl/bcm/pinctrl-brcmstb.c | 26 +++++++++++---------------
2 files changed, 13 insertions(+), 29 deletions(-)
--
2.34.1
next reply other threads:[~2026-11-06 7:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 7:06 Wang Xiaolei [this message]
2026-11-06 7:06 ` [PATCH 1/3] pinctrl: bcm: Fix off-by-one and out-of-bounds access in fsel_get() Wang Xiaolei
2026-11-10 17:46 ` Florian Fainelli
2026-11-06 7:06 ` [PATCH 2/3] pinctrl: bcm: Use pinconf_generic_dt_free_map in bcm2835 Wang Xiaolei
2026-11-10 17:48 ` Florian Fainelli
2026-11-06 7:06 ` [PATCH 3/3] pinctrl: bcm: Use pinconf_generic_dt_free_map in brcmstb Wang Xiaolei
2026-11-10 17:49 ` Florian Fainelli
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=20261106070628.1428691-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®