diff options
| author | Sarah Emery <sarah.emery@canonical.com> | 2026-08-28 17:58:17 +0200 |
|---|---|---|
| committer | Linus Walleij <linusw@kernel.org> | 2026-09-14 10:59:33 +0200 |
| commit | 51ae99659469edba2e83931efa26b77d36ca02c2 (patch) | |
| tree | 43c6d39b4902d9291a6c81861f78db535ce908f6 /tools/perf/scripts/python/flamegraph.py | |
| parent | 692f32609a30f75ca3401e25b504bfd06bd5662a (diff) | |
| download | linux-next-51ae99659469edba2e83931efa26b77d36ca02c2.tar.gz linux-next-51ae99659469edba2e83931efa26b77d36ca02c2.zip | |
pinctrl: generic: serialise pinctrl_generic_dt_node_to_map()
pinctrl_generic_add_group() documents that the caller must take care of
locking, and pinmux_generic_add_function() needs it too, but
pinctrl_generic_dt_node_to_map() calls them without holding
pctldev->mutex, and the core caller in create_pinctrl() does not take it
either.
The driver core calls pinctrl_bind_pins() before probing a device, so
two devices that reference the same pin controller can run
pinctrl_generic_dt_node_to_map() on one pctldev at the same time.
Both `add` functions take the new selector from pctldev->num_groups or
pctldev->num_functions, and radix_tree_insert() at that index.
Two racing callers can read the same selector before either
has inserted, so the second insert collides and fails:
k1-pinctrl d401e000.pinctrl:
error -EEXIST: error adding function pcie2-0-cfg
k1-pinctrl d401e000.pinctrl:
does not have pin group pcie0-0-cfg.pcie0-0-pins
leaving one consumer without its pin configuration.
This was hit on a SpacemiT K3 board, where PCIe devices probe in parallel
against the single shared pin controller.
Take pctldev->mutex across the whole function, so that the groups and the
function referring are in a single critical section.
Fixes: 43722575e5cd ("pinctrl: add generic functions + pins mapper")
Signed-off-by: Sarah Emery <sarah.emery@canonical.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions
