diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-05-10 17:15:52 +0300 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2021-06-02 10:50:00 +0100 |
commit | 5a23e8b0fd6010e25ae58362292235cc9213ca57 (patch) | |
tree | ef6428fc483c2e1b7f6259edef2262c36b2886bb /drivers/mfd/syscon.c | |
parent | f62da567d8ad76185a5232a4e0250576773a1c0c (diff) | |
download | lwn-5a23e8b0fd6010e25ae58362292235cc9213ca57.tar.gz lwn-5a23e8b0fd6010e25ae58362292235cc9213ca57.zip |
mfd: Remove software node conditionally and locate at right place
Currently the software node is removed in error case and at ->remove()
stage unconditionally, that ruins the symmetry. Besides, in some cases,
when mfd_add_device() fails, the device_remove_software_node() call
may lead to NULL pointer dereference:
BUG: kernel NULL pointer dereference, address: 00000000
...
EIP: strlen+0x12/0x20
...
kernfs_name_hash+0x13/0x70
kernfs_find_ns+0x32/0xc0
kernfs_remove_by_name_ns+0x2a/0x90
sysfs_remove_link+0x16/0x30
software_node_notify.cold+0x34/0x6b
device_remove_software_node+0x5a/0x90
mfd_add_device.cold+0x30a/0x427
Fix all these by guarding device_remove_software_node() with a conditional
and locating it at the right place.
Fixes: 42e59982917a ("mfd: core: Add support for software nodes")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/syscon.c')
0 files changed, 0 insertions, 0 deletions