Revision 357798909164bf423eac6a78ff7da7e98d2d7f7f authored by Geert Uytterhoeven on 24 April 2019, 13:59:33 UTC, committed by Linus Walleij on 25 April 2019, 07:12:00 UTC
The err_remove_chip block is too coarse, and may perform cleanup that must not be done. E.g. if of_gpiochip_add() fails, of_gpiochip_remove() is still called, causing: OF: ERROR: Bad of_node_put() on /soc/gpio@e6050000 CPU: 1 PID: 20 Comm: kworker/1:1 Not tainted 5.1.0-rc2-koelsch+ #407 Hardware name: Generic R-Car Gen2 (Flattened Device Tree) Workqueue: events deferred_probe_work_func [<c020ec74>] (unwind_backtrace) from [<c020ae58>] (show_stack+0x10/0x14) [<c020ae58>] (show_stack) from [<c07c1224>] (dump_stack+0x7c/0x9c) [<c07c1224>] (dump_stack) from [<c07c5a80>] (kobject_put+0x94/0xbc) [<c07c5a80>] (kobject_put) from [<c0470420>] (gpiochip_add_data_with_key+0x8d8/0xa3c) [<c0470420>] (gpiochip_add_data_with_key) from [<c0473738>] (gpio_rcar_probe+0x1d4/0x314) [<c0473738>] (gpio_rcar_probe) from [<c052fca8>] (platform_drv_probe+0x48/0x94) and later, if a GPIO consumer tries to use a GPIO from a failed controller: WARNING: CPU: 0 PID: 1 at lib/refcount.c:156 kobject_get+0x38/0x4c refcount_t: increment on 0; use-after-free. Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc2-koelsch+ #407 Hardware name: Generic R-Car Gen2 (Flattened Device Tree) [<c020ec74>] (unwind_backtrace) from [<c020ae58>] (show_stack+0x10/0x14) [<c020ae58>] (show_stack) from [<c07c1224>] (dump_stack+0x7c/0x9c) [<c07c1224>] (dump_stack) from [<c0221580>] (__warn+0xd0/0xec) [<c0221580>] (__warn) from [<c02215e0>] (warn_slowpath_fmt+0x44/0x6c) [<c02215e0>] (warn_slowpath_fmt) from [<c07c58fc>] (kobject_get+0x38/0x4c) [<c07c58fc>] (kobject_get) from [<c068b3ec>] (of_node_get+0x14/0x1c) [<c068b3ec>] (of_node_get) from [<c0686f24>] (of_find_node_by_phandle+0xc0/0xf0) [<c0686f24>] (of_find_node_by_phandle) from [<c0686fbc>] (of_phandle_iterator_next+0x68/0x154) [<c0686fbc>] (of_phandle_iterator_next) from [<c0687fe4>] (__of_parse_phandle_with_args+0x40/0xd0) [<c0687fe4>] (__of_parse_phandle_with_args) from [<c0688204>] (of_parse_phandle_with_args_map+0x100/0x3ac) [<c0688204>] (of_parse_phandle_with_args_map) from [<c0471240>] (of_get_named_gpiod_flags+0x38/0x380) [<c0471240>] (of_get_named_gpiod_flags) from [<c046f864>] (gpiod_get_from_of_node+0x24/0xd8) [<c046f864>] (gpiod_get_from_of_node) from [<c0470aa4>] (devm_fwnode_get_index_gpiod_from_child+0xa0/0x144) [<c0470aa4>] (devm_fwnode_get_index_gpiod_from_child) from [<c05f425c>] (gpio_keys_probe+0x418/0x7bc) [<c05f425c>] (gpio_keys_probe) from [<c052fca8>] (platform_drv_probe+0x48/0x94) Fix this by splitting the cleanup block, and adding a missing call to gpiochip_irqchip_remove(). Fixes: 28355f81969962cf ("gpio: defer probe if pinctrl cannot be found") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 102bbe3
File | Mode | Size |
---|---|---|
partitions | ||
Kconfig | -rw-r--r-- | 6.5 KB |
Kconfig.iosched | -rw-r--r-- | 1.1 KB |
Makefile | -rw-r--r-- | 1.5 KB |
badblocks.c | -rw-r--r-- | 14.5 KB |
bfq-cgroup.c | -rw-r--r-- | 33.5 KB |
bfq-iosched.c | -rw-r--r-- | 194.9 KB |
bfq-iosched.h | -rw-r--r-- | 35.0 KB |
bfq-wf2q.c | -rw-r--r-- | 52.5 KB |
bio-integrity.c | -rw-r--r-- | 12.9 KB |
bio.c | -rw-r--r-- | 54.5 KB |
blk-cgroup.c | -rw-r--r-- | 46.6 KB |
blk-core.c | -rw-r--r-- | 48.6 KB |
blk-exec.c | -rw-r--r-- | 2.5 KB |
blk-flush.c | -rw-r--r-- | 14.4 KB |
blk-integrity.c | -rw-r--r-- | 12.0 KB |
blk-ioc.c | -rw-r--r-- | 10.2 KB |
blk-iolatency.c | -rw-r--r-- | 28.1 KB |
blk-lib.c | -rw-r--r-- | 10.2 KB |
blk-map.c | -rw-r--r-- | 5.9 KB |
blk-merge.c | -rw-r--r-- | 24.1 KB |
blk-mq-cpumap.c | -rw-r--r-- | 1.7 KB |
blk-mq-debugfs-zoned.c | -rw-r--r-- | 435 bytes |
blk-mq-debugfs.c | -rw-r--r-- | 26.2 KB |
blk-mq-debugfs.h | -rw-r--r-- | 2.7 KB |
blk-mq-pci.c | -rw-r--r-- | 1.7 KB |
blk-mq-rdma.c | -rw-r--r-- | 1.7 KB |
blk-mq-sched.c | -rw-r--r-- | 13.2 KB |
blk-mq-sched.h | -rw-r--r-- | 2.6 KB |
blk-mq-sysfs.c | -rw-r--r-- | 8.4 KB |
blk-mq-tag.c | -rw-r--r-- | 14.5 KB |
blk-mq-tag.h | -rw-r--r-- | 2.3 KB |
blk-mq-virtio.c | -rw-r--r-- | 1.7 KB |
blk-mq.c | -rw-r--r-- | 84.5 KB |
blk-mq.h | -rw-r--r-- | 6.5 KB |
blk-pm.c | -rw-r--r-- | 6.6 KB |
blk-pm.h | -rw-r--r-- | 1.4 KB |
blk-rq-qos.c | -rw-r--r-- | 6.3 KB |
blk-rq-qos.h | -rw-r--r-- | 4.4 KB |
blk-settings.c | -rw-r--r-- | 26.7 KB |
blk-softirq.c | -rw-r--r-- | 3.7 KB |
blk-stat.c | -rw-r--r-- | 4.6 KB |
blk-stat.h | -rw-r--r-- | 4.6 KB |
blk-sysfs.c | -rw-r--r-- | 25.2 KB |
blk-throttle.c | -rw-r--r-- | 67.9 KB |
blk-timeout.c | -rw-r--r-- | 3.7 KB |
blk-wbt.c | -rw-r--r-- | 19.9 KB |
blk-wbt.h | -rw-r--r-- | 3.0 KB |
blk-zoned.c | -rw-r--r-- | 11.7 KB |
blk.h | -rw-r--r-- | 10.1 KB |
bounce.c | -rw-r--r-- | 9.4 KB |
bsg-lib.c | -rw-r--r-- | 10.4 KB |
bsg.c | -rw-r--r-- | 11.3 KB |
cmdline-parser.c | -rw-r--r-- | 4.9 KB |
compat_ioctl.c | -rw-r--r-- | 10.9 KB |
elevator.c | -rw-r--r-- | 16.4 KB |
genhd.c | -rw-r--r-- | 49.5 KB |
ioctl.c | -rw-r--r-- | 15.3 KB |
ioprio.c | -rw-r--r-- | 5.1 KB |
kyber-iosched.c | -rw-r--r-- | 28.3 KB |
mq-deadline.c | -rw-r--r-- | 20.6 KB |
opal_proto.h | -rw-r--r-- | 9.3 KB |
partition-generic.c | -rw-r--r-- | 17.1 KB |
scsi_ioctl.c | -rw-r--r-- | 19.1 KB |
sed-opal.c | -rw-r--r-- | 58.8 KB |
t10-pi.c | -rw-r--r-- | 7.9 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...