You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails
commit4ad09d956fupstream. 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:b662f809d4("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fa9efcbfbf
commit
456e895fd0
@@ -58,8 +58,12 @@ int iio_register_sw_trigger_type(struct iio_sw_trigger_type *t)
|
|||||||
|
|
||||||
t->group = configfs_register_default_group(iio_triggers_group, t->name,
|
t->group = configfs_register_default_group(iio_triggers_group, t->name,
|
||||||
&iio_trigger_type_group_type);
|
&iio_trigger_type_group_type);
|
||||||
if (IS_ERR(t->group))
|
if (IS_ERR(t->group)) {
|
||||||
|
mutex_lock(&iio_trigger_types_lock);
|
||||||
|
list_del(&t->list);
|
||||||
|
mutex_unlock(&iio_trigger_types_lock);
|
||||||
ret = PTR_ERR(t->group);
|
ret = PTR_ERR(t->group);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user