diff options
author | Stefan Agner <stefan@agner.ch> | 2016-10-18 17:09:15 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-10-31 16:25:15 -0400 |
commit | 9999fe5df58773489b9564467b5c8cfb364e0b80 (patch) | |
tree | 85eb4e7a1fbcd5861ae84db0bf0f0da1a25b6a3b /drivers/pinctrl | |
parent | 0553d8d0b03ad58f9917460c40a2e2b680f5bfdb (diff) |
pinctrl: imx: reset group index on probe
Group index is incremented on every new group parsed. Since the
field is part of struct imx_pinctrl_soc_info, which is typically
a global variable passed by the individual pinctrl-imx.c based
driver, it does not get cleared automatically when re-probing the
driver. This lead imx_pinctrl_parse_functions passing a group
pointer which is outside of the allocated group space on second
probe and onwards. Typically this ended up in a NULL pointer
dereference when accessing the name field like this:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
...
PC is at strcmp+0x18/0x44
LR is at imx_dt_node_to_map+0xc4/0x290
Avoid this by setting group_index to 0 on probe.
This has been observed when using DEBUG_TEST_DRIVER_REMOVE.
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/freescale/pinctrl-imx.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c index 47613201269a..79c4e14a5a75 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx.c +++ b/drivers/pinctrl/freescale/pinctrl-imx.c | |||
@@ -687,6 +687,7 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev, | |||
687 | if (!info->functions) | 687 | if (!info->functions) |
688 | return -ENOMEM; | 688 | return -ENOMEM; |
689 | 689 | ||
690 | info->group_index = 0; | ||
690 | if (flat_funcs) { | 691 | if (flat_funcs) { |
691 | info->ngroups = of_get_child_count(np); | 692 | info->ngroups = of_get_child_count(np); |
692 | } else { | 693 | } else { |