]> git.baikalelectronics.ru Git - kernel.git/commit
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
authorChen Zhongjin <chenzhongjin@huawei.com>
Tue, 8 Nov 2022 03:28:02 +0000 (11:28 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 12 Nov 2022 17:53:35 +0000 (17:53 +0000)
commitaffecefd49660e62866d26c7727169b3de4ab1f4
treec63937494049202f21690bae7a82fd51feafecb5
parent0128457fed4629d1c133fb91b3d2e19a3c0986c3
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails

In iio_register_sw_trigger_type(), configfs_register_default_group() is
possible to fail, but the entry add to iio_trigger_types_list is not
deleted.

This leaves wild in iio_trigger_types_list, which can cause page fault
when module is loading again. So fix this by list_del(&t->list) in error
path.

BUG: unable to handle page fault for address: fffffbfff81d7400
Call Trace:
<TASK>
 iio_register_sw_trigger_type
 do_one_initcall
 do_init_module
 load_module
 ...

Fixes: c82a446bf3e4 ("iio: core: Introduce IIO software triggers")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
Link: https://lore.kernel.org/r/20221108032802.168623-1-chenzhongjin@huawei.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-sw-trigger.c